WatchDirectory home page
WatchDirectory Startseite (Deutsche Version)
Site WatchDirectory (Français)
  Welcome, Guest. Please Login or Register
YaBB - Yet another Bulletin Board
   
  HomeHelpSearchLoginRegister  
 
Page Index Toggle Pages: 1
Batch delete files in other folder (Read 1047 times)
Don W
YaBB Newbies
*
Offline



Posts: 2
USA, Colorado
Batch delete files in other folder
Sep 2nd, 2014 at 11:16pm
 
I have enjoyed learning about your software. 

I have a shared drive mapped to everyone’s computer as R: (\\patriots\released_drawings) that they work out of. My users copy files from the “-=Review-MRRs=-“ to the “Cust-Disp-HOLD” and forget to delete the one in the Review-MRRs folder. I wrote the following bat script to keep cleaning up the “-=Review-MRRs=-“ folder after the users.

Folder structure r:\-=Review-MRRs=-\Cust-Disp-HOLD

(the following is all on one line in a BAT file) This bat file is run under a task in watch directory when a new file is put in the “cust-disp-hold” folder.

for /f %%v in ('dir "\\patriots\released_drawings\-=Review-MRRs=-\Cust-Disp-HOLD\*.*" /b') do ( if exist "\\patriots\released_drawings\-=Review-MRRs=-\%%v" del \F "\\patriots\released_drawings\-=Review-MRRs=-\%%v");

Sense this fires for every new file in "Cust-Disp-Hold" directory. Is there a way to only try to delete only the new file from the other directory?
Back to top
 
 
IP Logged
 
Don W
YaBB Newbies
*
Offline



Posts: 2
USA, Colorado
Re: Batch delete files in other folder
Reply #1 - Sep 4th, 2014 at 6:46pm
 
Gert... as usual you have the information in your documentation. I did further reading and found the environment variables I could use.

http://www.watchdirectory.net/wdhelp/plugins/wdopAutoRunBatEnv.html

del "\\patriots\released_drawings\-=Review-MRRs=-\%WD_FILE_N%";

OR (produce no error in the log file)

if exist "\\patriots\released_drawings\-=Review-MRRs=-\%WD_FILE_N%" del "\\patriots\released_drawings\-=Review-MRRs=-\%WD_FILE_N%";
Back to top
 
 
IP Logged
 
Page Index Toggle Pages: 1