WatchDirectory home page
WatchDirectory Startseite (Deutsche Version)
Site WatchDirectory (Français)
  Welcome, Guest. Please Login or Register
YaBB - Yet another Bulletin Board
  ... File Viking Released! - The Drag & Drop File Processor
  HomeHelpSearchLoginRegister  
 
Page Index Toggle Pages: 1
Wish: Trigger for first file only within x seconds (Read 3142 times)
Dschuwi
YaBB Newbies
*
Offline



Posts: 14
Wish: Trigger for first file only within x seconds
Sep 9th, 2010 at 4:33pm
 
I have set email alert if new files arrive in a directory.

I would like to get a mail once only, then have the task suspended for a certain amount of time, so I don't get flooded with mails of every single file.
This wish is actually not restricted to the email plugin, it could be an interesting general event option.

And if you tell me now, this is possible already, I could not find out how to do this, but I would not be surprised... Smiley
Back to top
 
 
IP Logged
 
Gert
YaBB Administrator
*****
Offline



Posts: 1952
The Netherlands
Re: Wish: Trigger for first file only within x sec
Reply #1 - Sep 9th, 2010 at 5:14pm
 
Interesting idea....

For the Email task, something like this is possible by using the Combine option, see the bottom of this page:
http://www.watchdirectory.net/wdhelp/plugins/wdopAutoEmail.html

When you use the "Combine" option, you receive 1 email with several notifications combined.
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
 
Dschuwi
YaBB Newbies
*
Offline



Posts: 14
Re: Wish: Trigger for first file only within x sec
Reply #2 - Sep 13th, 2010 at 9:54am
 
Gert wrote on Sep 9th, 2010 at 5:14pm:
When you use the "Combine" option, you receive 1 email with several notifications combined.


Works basically, but I donot get a "combined" mail - I receive a mail after the specified amount of time, but with the text of the first new file only.
(in that case it would be definitely better to get it immediately after the first file, and then wait for e.g. ten minutes).

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



Posts: 1952
The Netherlands
Re: Wish: Trigger for first file only within x sec
Reply #3 - Sep 13th, 2010 at 11:24am
 
While there should be multiple combined notifications? Are you saying you do not receive some notifications when you combine them?

Can you email me your task settings as described in this blogpost:
http://watchdirftp.blogspot.com/2010/06/send-task-backup-to-support.html
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
 
YorkieBar
YaBB Newbies
*
Offline



Posts: 18
Re: Wish: Trigger for first file only within x sec
Reply #4 - Oct 13th, 2010 at 1:45pm
 
We have a need to EITHER trigger a task only once every x seconds OR identify a file isn't present in a directory.

We FTP download a series of files and need to read and process each file separately using an Excel Program called by a Start Any Program task.
The processing time for each file can vary depending on the file size but is typically 15-90 seconds.
I want to be able to
 Drop the FTP file into a directory with a static name (e.g. input.txt)
 Run the Start Any Program Excel Macro - after various calculations this task renames input.txt to outputYYMMSSHHMMSS.txt
 After x seconds copy the next FTP file into the directory again called input.txt
 Run the Start Any Program task etc

Alternatively - Is there a way to copy the next FTP file into the directory only when input.txt does not already exist.
Back to top
 
 
IP Logged
 
Gert
YaBB Administrator
*****
Offline



Posts: 1952
The Netherlands
Re: Wish: Trigger for first file only within x sec
Reply #5 - Oct 14th, 2010 at 5:17am
 
Quote:
Alternatively - Is there a way to copy the next FTP file into the directory only when input.txt does not already exist.


I think this might work:
Use the "Copy" task and make sure to let it NOT copy if the file exists
This task should use the "File Age" monitoring method:
- Files older than 1 minute
- Do NOT remember triggered files
This last setting (NOT remember....) will cause the task to "fire" for all existing files again and again. If you do select the option to remember triggered files, it will only try to copy files once.

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
 
YorkieBar
YaBB Newbies
*
Offline



Posts: 18
Re: Wish: Trigger for first file only within x sec
Reply #6 - Oct 14th, 2010 at 12:29pm
 
I am trying this out but am unclear how the files will move singularly.
The FTP transfer drops a number of files (5+) into a FTPTemp directory with names File001.csv, File002.csv etc.
The Excel program needs to work with a static file name in a set directory e.g. DirExcel

I therefore need to copy File001.csv from directory FTPTemp to DirExcel and rename it from File001.csv to input.txt.
When file input.txt exists in DirExcel the Excel program task starts, processes and renames input.txt
Until input.txt has been processed I don't want File002.csv to be copied/renamed.
The Copy Task has the option to NOT copy if the file exists but doesn't allow a rename at the same time i.e. it picks up File001.csv and moves it as File001.csv not input.txt.
What step am I missing?  Huh
Back to top
 
 
IP Logged
 
Gert
YaBB Administrator
*****
Offline



Posts: 1952
The Netherlands
Re: Wish: Trigger for first file only within x sec
Reply #7 - Oct 14th, 2010 at 12:46pm
 
I forgot about that rename requirement.
Instead of the "Copy Files" task, use the "Run a batch file" task and let it start this script:
Code:
rem where should the detected file be moved to?
SET TARGETFILE=input.txt
SET TARGETDIR=C:\DirExcel
rem if the target file exists, how long to wait before trying again?
SET SLEEP=5

:SleepLoop
IF NOT EXIST "%TARGETDIR%\%TARGETFILE%" GOTO :ContinueMove
"%WD_INSTDIR%\GdPUtil.exe" -sleep %SLEEP%
GOTO :SleepLoop


:ContinueMove
MOVE "%WD_FILE%" "%TARGETDIR%\%TARGETFILE%"

 



I think that should work fine.
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
 
YorkieBar
YaBB Newbies
*
Offline



Posts: 18
Re: Wish: Trigger for first file only within x sec
Reply #8 - Oct 14th, 2010 at 3:11pm
 
Thanks Gert - it's just what we needed. Smiley
This is a great way to create a sequential process queue.
Back to top
 
 
IP Logged
 
Page Index Toggle Pages: 1