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?
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?
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
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
That kind of error suggests the server's path statement is messed up. Can you post it?
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.
Again, a solution without fancy commands and reasonably flexible would be enough.
ASKER
Here is the path variable:
Path=C:\Program Files\Support Tools\;C:\Program Files\HP\NCU;C:\WINDOWS\sy stem32;C:\ WINDOWS;C: \WINDOWS\S ystem32\Wb em;C:\Prog ram 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:\Prog ram Files\GnuWin32\bin;C:\Prog ram Files\Microsoft SQL Server\90\Tools\binn\
Path=C:\Program Files\Support Tools\;C:\Program Files\HP\NCU;C:\WINDOWS\sy
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?
ASKER
the for isn't failing now, it used to be failing in the past. I tried again today, and it worked.