'IF EXIST' in a .bat script to test for an empty directory
Posted on 2006-06-13
I would like to test if an directory is empty, using a simple batch script.
I wrote the following line:
if not exist "%ProgramFiles%\Epos9300\nul" echo Path does not exist
My Problem is:
I want to run this batch file in Windows XP operating systems with different languages.
For example in the English windows version the system variable %ProgramFiles% includes a white space. (...\Program Files\...)
Therefore I must put the whole path into double quotas.
But with double quotas the 'exist' command does not recognize an empty directory anymore.