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
How to:  Delete plugin (Read 5746 times)
mkanet
Junior Member
**
Offline



Posts: 64
How to:  Delete plugin
Feb 13th, 2012 at 2:44pm
 
Hi Gert, I would like for the "Delete Files" plugin to ONLY delete empty relative directories if no folders that end with .tmp are detected.

It sounds very simple, but I can't figure out how to do this. Sad

Below is the WD task I created; hoping WD would stop processing any further events IF it sees a folder with .tmp extension.  However, this does not work.  I have tried multiple combinations; but all failed.

...

PS:  This watch directory "Delete Files" task also deletes any files with specific extensions.  I would prefer to limit all of this to only WatchDirectory task if at all possible.
Thanks, as always!
Michael
Back to top
« Last Edit: Feb 13th, 2012 at 7:18pm by mkanet »  
 
IP Logged
 
Gert
YaBB Administrator
*****
Offline



Posts: 2239
The Netherlands
Re: How to:  Delete plugin
Reply #1 - Feb 14th, 2012 at 8:40am
 
Quote:
It sounds very simple

And you got me confused Wink

Are you trying to
delete *.nfo files that are NOT in *.tmp directories
remove empty *.tmp directories

because I think that's what the filters say....

Perhaps you can give some examples using full paths telling which file/dir should be removed so I can understand better.

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
 
mkanet
Junior Member
**
Offline



Posts: 64
Re: How to:  Delete plugin
Reply #2 - Feb 14th, 2012 at 2:59pm
 
Hi Gert, not that's not at all what I want to do.  I want to delete any empty folders ONLY IF folders with the name *.tmp don't exist.  I also want to delete other types of files with various extensions; but, it's not necessary to do it in the same WD task.

Scan folder E:\Downloads

If the folder "E:\Downloads\empty_folder" is empty delete it

If there there exists a folder called "E:\Downloads\temp_zip_Rar_folder.tmp" and there is a empty folder called "E:\Downloads\empty_folder" do NOT delete it until "E:\Downloads\temp_zip_Rar_folder.tmp" is gone.
Back to top
 
 
IP Logged
 
Gert
YaBB Administrator
*****
Offline



Posts: 2239
The Netherlands
Re: How to:  Delete plugin
Reply #3 - Feb 14th, 2012 at 3:08pm
 
So basically....

If there is ANY folder named "*.tmp" inside the monitored folder, for example those folders would qualify
C:\Mon\SomeSub.tmp\Anothersubfolder
c:\Mon\hello\SomeSub.tmp
Then no folders (tmp or otherwise) should EVER be deleted.

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
 
mkanet
Junior Member
**
Offline



Posts: 64
Re: How to:  Delete plugin
Reply #4 - Feb 14th, 2012 at 3:09pm
 
Yes, no empty folders should "ever be deleted" UNTIL "c:\Mon\hello\SomeSub.tmp" is gone.
Back to top
 
 
IP Logged
 
Gert
YaBB Administrator
*****
Offline



Posts: 2239
The Netherlands
Re: How to:  Delete plugin
Reply #5 - Feb 14th, 2012 at 3:18pm
 
OK,

For that you will need the "Run a bat file" task.
Set it to File Age method, poll every XX seconds (for example every minute), do NOT enable "remember triggered files"
Only select the DIRNEW event.

The script will be something like this:
Code:
rem check if there is a tmp folder somewhere below the monitored directory
DIR /s /ad "%WD_DIR%\*.tmp"
if %errorlevel% EQU 0 GOTO :EOF

rem no tmp directory found, try to remove the directory which triggered us
rem if it gives an error, ignore it. Most likely the directory is not empty
RD "%WD_FILE%"
 



Not tested but it should work.
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
 
mkanet
Junior Member
**
Offline



Posts: 64
Re: How to:  Delete plugin
Reply #6 - Feb 14th, 2012 at 3:31pm
 
Thanks I will try it!!!
Back to top
 
 
IP Logged
 
Gert
YaBB Administrator
*****
Offline



Posts: 2239
The Netherlands
Re: How to:  Delete plugin
Reply #7 - Feb 14th, 2012 at 4:45pm
 
Do not make things confusing by talking about yet another task.

Nothing can be done "immediately", there will always be a delay. Do I understand the 60 seconds (the interval I suggested for this task) is too much? So how much is ok?
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
 
mkanet
Junior Member
**
Offline



Posts: 64
Re: How to:  Delete plugin
Reply #8 - Feb 14th, 2012 at 5:14pm
 
Yes, I would much prefer for it to happen immediately (around 1 second).  The only reason I mentioned another task is because they both need the same condition (do not execute if *.tmp folders present).   

The other WD task executes a batch file as soon as an audio/video file is created or deleted.  Unlike the original task, this one DOES have to happen immediately after a *.tmp folder disappears.

Wouldn't it better to add a condition to the WD "delete file(s)" and "execute batch file" plugins to not execute if a file or folder exists?  This would be much easier for the user and much more efficient in processing the action immediately.

Gert wrote on Feb 14th, 2012 at 4:45pm:
Do not make things confusing by talking about yet another task.

Nothing can be done "immediately", there will always be a delay. Do I understand the 60 seconds (the interval I suggested for this task) is too much? So how much is ok?

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



Posts: 2239
The Netherlands
Re: How to:  Delete plugin
Reply #9 - Feb 14th, 2012 at 5:22pm
 
Yes that would be much easier for "the user", provided that you are the only user because adding this option would potentially add confusion for everyone else.

I will need to think about this.
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