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
'remove the directory if it is empty' option (Read 774 times)
Mel25
YaBB Newbies
*
Offline



Posts: 1
'remove the directory if it is empty' option
Feb 15th, 2016 at 3:55pm
 
I have a watched folder called \Scratch and have set up an 'Automatically Copy Files' task to monitor it with the option 'Remove the file after successful copy' enabled. After the WatchDirectory task runs, the files are all removed successfully, but there are lots of empty subfolders left in place, which I want removed.

I see an option when setting up the task called 'Remove the directory if it is empty'. If I enable it, does this apply only to the subfolders? I don't want it to remove the root \Scratch folder.

Thanks.
Back to top
 
 
IP Logged
 
Gert
YaBB Administrator
*****
Offline



Posts: 2225
The Netherlands
Re: 'remove the directory if it is empty' option
Reply #1 - Feb 15th, 2016 at 6:04pm
 
Hi,

The best way to implement it is to create a new task with the "delete files" plugin.

On the "Filter Events" window, make sure to remove the default "*.autodelete" filter.

On the "Events" window by default there are 2 events selected "FILENEW" (to delete files) and "DIRNEW" (to delete directories - only empty directories). Only select "DIRNEW".

On "Monitoring Method" select "File Age" and let it trigger for "files and directories" older than X minutes. Do not set the option "Remember triggered files".

Using above settings, this task will look for (and remove) empty directories when they are old enough.
Back to top
 

Gert Rijs - gert (at) gdpsoftware (dot) com
Blog: http://blog-en.gdpsoftware.com/
End Alzheimer's: http://www.alz.org&&...
WWW WWW GdPSoftware  
IP Logged
 
Gert
YaBB Administrator
*****
Offline



Posts: 2225
The Netherlands
Re: 'remove the directory if it is empty' option
Reply #2 - Feb 15th, 2016 at 6:05pm
 
... and won't remove the monitored directory itself (c:\scratch)
Back to top
 

Gert Rijs - gert (at) gdpsoftware (dot) com
Blog: http://blog-en.gdpsoftware.com/
End Alzheimer's: http://www.alz.org&&...
WWW WWW GdPSoftware  
IP Logged
 
Page Index Toggle Pages: 1