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
Environment Variable for Latest File Created (Read 2185 times)
typecasket
YaBB Newbies
*
Offline



Posts: 2
Environment Variable for Latest File Created
Oct 18th, 2012 at 10:58am
 
Hello Gert,

First of all, I would like to thank you for your superb article on QUIET by filter FILENEW (sending an email if no file is created within x seconds). I don't see that feature available to any monitoring tools online.
However I would like to include the "last file created" in my email alert. I can't see its corresponding env't variable in your list. Can you possibly create it if not yet available? Thank you in advance, more power and all the best!

Kudos Amigo!
Cool
Back to top
 
 
IP Logged
 
Gert
YaBB Administrator
*****
Offline



Posts: 2238
The Netherlands
Re: Environment Variable for Latest File Created
Reply #1 - Oct 18th, 2012 at 11:43am
 
I guess you mean this blogpost: http://blog-en.gdpsoftware.com/2010/02/receive-email-when-no-files-are-created.h...

Currently you can not get the latest file info, but here is a work-around.

Create a new task using the "run a batch file" plugin. It should use the same settings as your other task but without the QUIET event. The bat file should look like this (one line)

@ECHO %WD_REASON% %WD_DTTM% %WD_FILE% > "C:\Temp\TheLastEvent.txt"

So this will write a line with the reason (FILENEW/FILECHNG...), timestamp and filename to "C:\Temp\TheLastEvent.txt", overwriting its old contents every time.

Now you can include this file in your email message for the QUIET event (in your original task), so the message body will be something like this:


Hello,
Nothing happened in the monitored directory for some time. The last event was:
@@@C:\Temp\TheLastEvent.txt@@@


Not tested but it should work.

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



Posts: 2
Re: Environment Variable for Latest File Created
Reply #2 - Oct 19th, 2012 at 5:37am
 
Hello Gert,

I created the "Run any bat file" first and followed your instructions but it did not write the output to LastEvent.txt after starting the task. Also how can I attach the file in my QUIET email message? I am seeing checkbox for "Attach the file (new and changed files only)" below the email message body.
Thanks for your quick response!

Kudos Amigo,
Cool
Back to top
 
 
IP Logged
 
Page Index Toggle Pages: 1