Link to home
Start Free TrialLog in
Avatar of mightyestme
mightyestme

asked on

DOS Script - Check if a folder is empty

During my daily processing, I need to move files from a source(incoming) folder to a target(processing) folder. Once the file is in my target folder, I kick off my application which processes this file. After my application completes processing, another script moves the file out of the processing folder.
Before I move my files from the incoming to the processing folder, I want to ensure that my processing folder is empty. I saw some solutions to the problem using the FOR command, but that command doesn't work at this client. How do I ensure that my target foler is empty before moving any new files into it?
Avatar of Lee W, MVP
Lee W, MVP
Flag of United States of America image

What do you mean the FOR command doesn't work at that client?  The For Command is built in to Windows Server.  How does it now work?  (are you trying to run it in command.com instead of cmd.exe?)
ASKER CERTIFIED SOLUTION
Avatar of mightyestme
mightyestme

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
That kind of error suggests the server's path statement is messed up.  Can you post it?
Avatar of mightyestme
mightyestme

ASKER

I will post the PATH as soon as possible. I have access to the server only 2 hours a day, and my 2 hours for today are now up. (This is not even production yet).

Again, a solution without fancy commands and reasonably flexible would be enough.
Here is the path variable:

Path=C:\Program Files\Support Tools\;C:\Program Files\HP\NCU;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\Program Files\IBM\DB2RuntimeClient 7\bin\;C:\Program Files\IBM\DB2RuntimeClient 7\function;C:\Program Files\IBM\DB2RuntimeClient 7\help\;C:\Program Files\BMC Software\Control-M Agent\Default\EXE\;C:\Program Files\GnuWin32\bin;C:\Program Files\Microsoft SQL Server\90\Tools\binn\
ok, that looks good... can you take a screen shot of the FOR command failing?  where it displays the command executed and the error message?
the for isn't failing now, it used to be failing in the past. I tried again today, and it worked.