WatchDirectory Forum
watchDirectory forums >> How to... >> How to Copy with a Condition

Message started by preisinger on Jan 9th, 2006 at 10:25pm

Title: How to Copy with a Condition
Post by preisinger on Jan 9th, 2006 at 10:25pm
I am evaluating the application and I am very impressed with it's capabilities
However, I have a particular need that I would like to test.

I have a need to move newly created directories as they are created. These directories contain several files including "output.txt"
-If "output.txt" is there then move the directory
-If "output.txt" is not there try again
-If "output.txt" is not there after 10 minutes send out an email

1) How do I place a condition on the copy statement?
2) Is it possible to have it evaluate the directory for x time? then after x time send an email if conditions are not met?

Title: Re: How to Copy with a Condition
Post by Gert on Jan 10th, 2006 at 4:32am
I think your best bet would be to create 2 tasks.

One will monitor for those new directories, and send an email if they still exist after 10 minutes. You can use the technique described in our newsletter  (the topic "files that MUST be deleted"). I am not 100% sure, but that technique should work for directories as well.

The other task will do the actual MOVE. You will need to use the Auto start a .bat file plugin for this. Use the files that trigger events tab so it will only run for the filemask *\output.txt.
Inside your .bat file, you move the complete directory. As the directory will be gone, your first task will not send an email. If output.txt doesn't show up in time, the first task will send an email.

Send me an email with some more details if you need help to create the .bat file.


Title: Re: How to Copy with a Condition
Post by preisinger on Jan 10th, 2006 at 11:28pm
I test out the Email notification when a directory is not deleted.
However It is emailing me for every directory whether I deleted it or left if in the directory.
I set the delay to 5 minutes and placed 3 directories into my monitor directory. I then deleted 2 of them within 1 minute.
I received an email for all 3 directories.
I would like to only receive an email for any directories remaining after 5 minutes.
I attached the backup zip.

edit: removed the zip file after I have downloaded it

Title: Re: How to Copy with a Condition
Post by Gert on Jan 11th, 2006 at 4:50am
A fixed version of wdRun.exe is posted in our beta forum.
Like I said before, I was not 100% sure the trick would also work with directories. The fixed wdRun now also checks if the directory still exists before calling your task for "new directories".


WatchDirectory Forum » Powered by YaBB 2.5.2!
YaBB Forum Software © 2000-2018. All Rights Reserved.