Standard edition $69 (US Dollar)
Professional edition $129 (US Dollar)
Volume discounts available
Or download the 30 day evaluation version of watchDirectory (~4 MB)
platforms Windows® 2000/XP/2003/Vista/2008/7
WatchDirectory Newsletter - Detecting an outbreak of new files
At most once a month we send a newsletter to keep you informed about watchDirectory.
You can unsubscribe anytime you want.
We care about your privacy and will not make your email available to other parties.
| Subscribe to the English language newsletter |
Den Deutschen Newsletter abonnieren |
|
|---|
|
Recently a customer asked whether watchDirectory can take action when more than 30 files were created during the last 10 minutes. When less files were created, nothing should happen. When more files were created, watchDirectory should send an e-mail alert. For this example, you should configure a new task that runs a batch file for all new files detected in the watched directory. The batch file will read the history database (the same as used by the Task History Viewer) to check how many files were created the last 10 minutes. When more than 30 files were created, the batch file will send an e-mail. The outbreak.bat scriptThe example script uses a program called sqlite3.exe, which is part of the excellent SQLite database engine
used by watchDirectory. The sqlite3 program is included in the download at the bottom of this page. rem path to sqlite3.exe (no "quotes") SET SQL=C:\outbreak\sqlite3.exe rem time interval to use in minutes SET MINUTES=10 rem the number of files allowed before triggering an email SET MAXFILE=30 rem who should receive the email alert? SET EMAIL=johnny@somewhere.net rem =============================================== rem ==== no need to change anything below here ==== rem =============================================== rem create temporary files inside C:\Documents and Settings\All Users\Application Data\watchDirectory\taskname\... SET TFBASE=%WD_TASKDIR%\F1%WD_CUREVT% rem compute the date/time of MINUTES minutes ago "%WD_INSTDIR%\GdPUtil.exe" -datetime -%MINUTES%m "%TFBASE%.bat" call "%TFBASE%.bat" del "%TFBASE%.bat" rem create the query SET TMST='%DT_YEAR%-%DT_MONTH%-%DT_DAY% %DT_HOUR%:%DT_MIN%:%DT_SEC%' rem always take care with pipe and "greater than" characters (escape them) ECHO Select 'set numfiles=' ^|^| count(*) from WDEVENTS where DTEVENT ^> %TMST%; > "%TFBASE%.SQL" rem and start the query type "%TFBASE%.SQL" | "%SQL%" "%WD_TASKDIR%\history.db" > "%TFBASE%NF.BAT" del "%TFBASE%.SQL" call "%TFBASE%NF.BAT" del "%TFBASE%NF.BAT" if %numfiles% LSS %MAXFILE% ( rem less than MAXFILE files were created the last MINUTES minutes goto :EOF ) rem more than MAXFILE files! send an email alert set EMAILFILE=%WD_TASKDIR%\..\System.Mail\Out\%WD_CONFIG%_%WD_CUREVT%.TMP echo ALERT: %numfiles% files created in directory %WD_DIR% > "%EMAILFILE%" echo %EMAIL% >> "%EMAILFILE%" echo. >> "%EMAILFILE%" echo. >> "%EMAILFILE%" echo. >> "%EMAILFILE%" echo. >> "%EMAILFILE%" echo Hi, >> "%EMAILFILE%" echo During the last %MINUTES% minutes there were %numfiles% files created inside directory %WD_DIR% >> "%EMAILFILE%" rem okay, the script is created, now rename it so the wdPostMan program processes it. ren "%EMAILFILE%" %WD_CONFIG%_%WD_CUREVT%.wdmail Download the outbreak example. Unzip all files into a new directory. C:\outbreak would be easiest as the example script is configured to use that directory. |
Standard edition $69 (US Dollar)
Professional edition $129 (US Dollar)
Volume discounts available
Or download the 30 day evaluation version of watchDirectory (~4 MB)
platforms Windows® 2000/XP/2003/Vista/2008/7
Customer testimonial
After a few months of running watchDirectory on three of our servers, already 500,000 files have been fully automatically processed by watchDirectory.
Without any crash, error or human intervention our FTP and internet servers are monitored by watchDirectory 24 hours a day, 7 days a week.Complete testimonial
Play a sound file when new files are created
Automatically play a WAV file when new files are created.
More ![]()
Do you want email notifications when directories change?
Let watchDirectory automatically email you when files are deleted, added or changed in a directory. You have complete control on the appearance of the email. Supports HTML email as well!
More ![]()
Send email for old files!
Receive email notifications for old files - great for workflow (e.g. warn John that he didn't process the file, and CC yourself and his colleagues...).
More ![]()
Automatically create Thumbnails for your Pictures
Create JPG, GIF or PNG thumbnails for new JPG, BMP, GIF, PNG, TIFF, PCX, TGA, WMF, EMF, PCD, and PSD files. Pictures can be automatically rotated as well!
More ![]()