Reputation: 31
I'm using this batch script to delete files
FORFILES /P "X:\test" /S /M *.bak /C "CMD /C DEL @path"
However, the X drive is a resource on an active/passive cluster. I have to run the batch file on both nodes. Two questions...
Upvotes: 3
Views: 6742
Reputation: 130919
It would be much faster to simply use DEL instead of FORFILES. You can test if the root path exists using IF EXIST.
if exist "x:\test\*.bak" del /q /s "x:\test\*.bak"
Upvotes: 8
Reputation: 3111
I just trying copying a file to the folder. Then check to see if the file exists afterward. If it does, I delete the file, and then I can proceed.
Upvotes: 0