Command to identity empty folders

  • Thread starter Thread starter Curious
  • Start date Start date
C

Curious

Is there a Windows command or utility that I can use to find out in a
given folder, what folders are empty (meaning they contain no files)?
 
Curious said:
Is there a Windows command or utility that I can use to find out in a
given folder, what folders are empty (meaning they contain no files)?

You can do a Dir command for FILES (negative for directories) and
apparently it sets the errorlevel if file not found (no regular files).

dir DirName /a-d & if errorlevel 1 echo Errorlevel: %errorlevel% no files
found

This means you can test for the errorlevel and and use the results to
execute different batch code.

/ad gives only results where the attribute is a DIRECTORY (or Junction
Point),
and /a-d changes this to where the attribute is "not a directory".
 
Curious said:
Is there a Windows command or utility that I can use to find out in a
given folder, what folders are empty (meaning they contain no files)?

43} Is there a way of counting the number of files in a folder?
57} How do I get a list of all my empty folders on c:\ ?
195399 May 17 2007 ftp://garbo.uwasa.fi/pc/link/tscmd.zip
tscmd.zip Useful NT/2000/XP script tricks and tips, T.Salmi

All the best, Timo
 
Back
Top