Command to identity empty folders

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)?
 
H

Herb Martin

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".
 
T

Timo Salmi

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top