contar archivos pero correctamente

Aquí puedes preguntar o compartir tus dudas y conocimientos acerca del programa
Hola
A alguien le pasa que cuando haces pruebas de copiado con las funciones file.copy y folder find si encuentras carpetas vacias me las cuenta como si fuera un archivo y lo cuenta como 0 kb? intento que me detecte que carpetas estan vacias y que carpetas no estan vacias. No consigo que no me las cuente como si estuviera lleno y que no le de 0 kb

ejemplo:
On globals:
function Folder.GetSize( cFolder )
  --[[
    Function returns -1 if folder does not exist, otherwise 
    it returns the sum of all files w/in it.
  --]]
  local nSize=-1;
  if Folder.DoesExist( cFolder ) then
    local tFiles = File.Find(cFolder,"*.*",true,false);
    nSize = 0;
    if tFiles and type(tFiles) == "table" then
    	local x;
    	for x=1,Table.Count(tFiles) do
    	  nSize = nSize + File.GetSize( tFiles[x] );
    	end
    end
  end
  return nSize;
end
En onclick (boton):
StartPath = Dialog.FolderBrowse("Please select a folder:", "AutoPlay\\Docs");
bSetSearch=true;
allMySubFolders = Folder.Find(StartPath.."\\", "*", bSetSearch, nil);--TABLA DE CARPETAS

FullSize = 0;
nSize = 0;

if StartPath ~= "" and StartPath ~= "CANCEL" then
	
	------------------------------
	if allMySubFolders ~= nil and bSetSearch == true then--si hay carpetas dentro de la principal 
	nbNumberOfFolders = Table.Count(allMySubFolders);--TOTAL DE CARPETAS ENCONTRADAS
	
		Dialog.TimedMessage("Please Wait...", "Encontradas un total de "..nbNumberOfFolders.." carpetas", 2000, MB_ICONINFORMATION);
	 	StatusDlg.Show(MB_ICONINFORMATION, true);
 
 		for count, data in pairs (allMySubFolders) do	
			
			StatusDlg.ShowProgressMeter(true);			
			StatusDlg.SetMeterRange(1, nbNumberOfFolders);
			StatusDlg.SetMeterPos((count*100/nbNumberOfFolders));
 		
 			totalFiles = File.Find(data.."\\", "*.*", true, true, nil, nil);
	
			if totalFiles ~= nil then--no estan vacioS

					  			
[color=#0000BF]	  				totalSize = String.GetFormattedSize(Folder.GetSize(data), FMTSIZE_AUTOMATIC, false);				
	  				if count~=nbNumberOfFolders then
  						TextFile.WriteFromString(_DesktopFolder.."\\llenos.txt", "["..count.."]| "..data.." - Tamaño: "..totalSize.."\r\n", true);  						
  					else
  						TextFile.WriteFromString(_DesktopFolder.."\\llenos.txt", "["..count.."]| "..data.." - Tamaño: "..totalSize, true);  						
	  				end[/color]
				

			end
		
			if totalFiles == nil then--subcarpetas estan vacios
				TextFile.WriteFromString(_DesktopFolder.."\\vacios.txt", "["..count.."]| "..data.."\r\n", true);										
			end

  		end
		StatusDlg.Hide();
		
			if (File.DoesExist(_DesktopFolder.."\\llenos.txt")==true) then
			conarchivos = TextFile.ReadToTable(_DesktopFolder.."\\llenos.txt");
			llenos = Table.Concat(conarchivos, "\r\n", 1, TABLE_ALL);
			else
			llenos = 0;
			end

			if (File.DoesExist(_DesktopFolder.."\\vacios.txt")==true) then	
			sinarchivos = TextFile.ReadToTable(_DesktopFolder.."\\vacios.txt");
			vacios = Table.Concat(sinarchivos, "\r\n", 1, TABLE_ALL);	
			else
			vacios = 0;
			end
		
			Dialog.TimedMessage("Please Wait1", "Rutas llenas: \r\n"..llenos.."\r\nRutas vacias: \r\n"..vacios, 2000, MB_ICONINFORMATION);
	
	------------------------------
	
	else--si no hay carpetas, miro si hay archivos o no...

		local totalFiles = File.Find(StartPath.."\\", "*.*", true, true, nil, nil);
		
		if totalFiles ~= nil then--hay archivos

			nbNumberOfFiles = Table.Count(totalFiles);
	
			Dialog.TimedMessage("---", "Encontradas un total de "..nbNumberOfFiles.." archivos", 2000, MB_ICONINFORMATION);
	 		StatusDlg.Show(MB_ICONINFORMATION, true);
	 
 			for count, filedata in pairs (totalFiles) do	
			StatusDlg.ShowProgressMeter(true);			
			StatusDlg.SetMeterRange(1, nbNumberOfFiles);
			StatusDlg.SetMeterPos((count*100/nbNumberOfFiles));
 		
				if totalFiles ~= nil then--no estan vacios	
				nSize = 0;
  				nSize = File.GetSize(totalFiles[count]);
  				totalSize = String.GetFormattedSize(nSize, FMTSIZE_AUTOMATIC, false);				
  				
  					if count~=nbNumberOfFolders then

  						TextFile.WriteFromString(_DesktopFolder.."\\filelist.txt", "["..count.."]| "..filedata.." - Tamaño: "..totalSize.."\r\n", true);  						
  						
  					else
  					TextFile.WriteFromString(_DesktopFolder.."\\filelist.txt", "["..count.."]| "..filedata.." - Tamaño: "..totalSize, true);
  					end
				end
		
  			end
			StatusDlg.Hide();
		end
		
		if totalFiles == nil then--no hay nada
		Dialog.TimedMessage("Please Wait3", "Archivos encontrados: 0", 2000, MB_ICONINFORMATION);			
		end
	end
	-----------------------------
	
else
--Application.ExitScript();
StartPath = "CANCEL"
end
Probadlo en vuestro ams y si poneis por ejemplo subcarpetas vacias y la carpeta raiz aparte con o sin algun archivo me las pone como llena en el archivo llenos.txt, como se impide que me cuente la carpeta como si fuera un archivo? alguien me echa una mano?
gracias!
Bueno lo he solucionado solo buscando el valor del peso real de la carpeta vacia, cambie esto (antiguo):
totalFiles = File.Find(data.."\\", "*.*", true, true, nil, nil);
	
			if totalFiles ~= nil then--no estan vacioS

					  			
[color=#0000BF]	  				totalSize = String.GetFormattedSize(Folder.GetSize(data), FMTSIZE_AUTOMATIC, false);				
	  				if count~=nbNumberOfFolders then
  						TextFile.WriteFromString(_DesktopFolder.."\\llenos.txt", "["..count.."]| "..data.." - Tamaño: "..totalSize.."\r\n", true);  						
  					else
  						TextFile.WriteFromString(_DesktopFolder.."\\llenos.txt", "["..count.."]| "..data.." - Tamaño: "..totalSize, true);  						
	  				end[/color]
				

			end
		
			if totalFiles == nil then--subcarpetas estan vacios
				TextFile.WriteFromString(_DesktopFolder.."\\vacios.txt", "["..count.."]| "..data.."\r\n", true);										
			end

Por esto (nuevo):
[color=#0040BF]totalFiles = File.Find(data.."\\", "*.*", true, true, nil, nil);
	
			if totalFiles ~= nil then--no estan vacioS

					  			
	  				totalSize = String.GetFormattedSize(Folder.GetSize(data), FMTSIZE_AUTOMATIC, false);				
	  				if count~=nbNumberOfFolders and totalSize ~= "0 bytes" then
  						TextFile.WriteFromString(_DesktopFolder.."\\llenos.txt", "["..count.."]| "..data.." - Tamaño: "..totalSize.."\r\n", true);  						
  					end
  					if count==nbNumberOfFolders and totalSize ~= "0 bytes" then
  						TextFile.WriteFromString(_DesktopFolder.."\\llenos.txt", "["..count.."]| "..data.." - Tamaño: "..totalSize, true);  						
	  				end
				

			end
		
			if totalFiles == nil then--subcarpetas estan vacios
				TextFile.WriteFromString(_DesktopFolder.."\\vacios.txt", "["..count.."]| "..data.."\r\n", true);										
			end[/color]
De todos modos sigo sin entender porque cojones cuentan las carpetas vacias como si tuvieran archivos y le dan 0 kb cuando (si se da el caso) esta vacia, en fin....