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
Limiting Notifications (Read 6231 times)
markklass
YaBB Newbies
*
Offline



Posts: 10
Limiting Notifications
Aug 17th, 2004 at 3:03am
 
Gert,

Thank you for your fast response and excellent software.  Makes me happy that we purchased your product!!

Another question....

I’m expecting about 130 files in one of my many monitored folders.  As you can imagine, I do not want 130 emails.  Is there a way I get one email as opposed to an email per new file?

Here's the catch, I’m monitoring many folders.  On 3/4 of my folders, I do want a notification for each file.

Thanks in advance.
Back to top
 
tendayrain1  
IP Logged
 
Gert
YaBB Administrator
*****
Offline



Posts: 2225
The Netherlands
Re: Limiting Notifications
Reply #1 - Aug 17th, 2004 at 3:50am
 
... tricky....
It depends how those 130 files arrive and when you want to be notified....

Do they come spread out over the day, and you want 1 email for the first one??

Do they come spread out over the day, and you want 1 email for the last one??
(no easy solution to this one I am afraid -- how to know when the last file arrives)

Do they come in 'bursts' (130 files in a few minutes), and you want to be notified for each 'burst'.....
(using nothingsChanged in combination with watchDirectory it is possible to implement this)

Those 3 scenarios should all be possible, but I need to know what you want....

Anyways, it is time to close down here for now.

Gert
Back to top
« Last Edit: Aug 18th, 2004 at 7:20pm by Gert »  

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



Posts: 10
Re: Limiting Notifications
Reply #2 - Aug 17th, 2004 at 5:12am
 
Spread out over the day, and I want 1 email for the first one.
Back to top
 
tendayrain1  
IP Logged
 
Gert
YaBB Administrator
*****
Offline



Posts: 2225
The Netherlands
Re: Limiting Notifications
Reply #3 - Aug 17th, 2004 at 12:04pm
 
Ok,

We have to work with a 'sentinel' file for that.
Lets assume the directory you want limited notifications for is C:\Monitor\Limit.

Add this to the top of your .bat file:
Code:
rem check if this is one of the directories where you want limited notifications
rem /i = ignore case  WD_RELDIR = directory-name relative to the monitored dir
IF /i "%WD_RELDIR%" == "Limit" goto :checklimit
IF /i "%WD_RELDIR%" == "AnotherLimited" goto :checklimit
GOTO :NotLimited

:checklimit
rem get todays date
GdPUtil -datetime c:\temp\dt.bat
call c:\temp\dt.bat
del c:\temp\dt.bat

rem if the sentinel file for this dir and date already exists
rem we just quit
rem :EOF (End Of File) is a predifined label in NT based scripts, do NOT add this label to your script!
IF EXIST "C:\Temp\%WD_RELDIR%_%DT_DATE%.sentinel" GOTO :EOF

rem the sentinel file does not exist, this is the first notification for
rem this directory.
rem create the sentinel file, so future notifications today will not
rem cause new email messages

ECHO SENTINEL > "C:\Temp\%WD_RELDIR%_%DT_DATE%.sentinel"
GOTO :NotLimited

:NotLimited
 ... the rest of your .bat file here ....
 



This will only work properly if the 'depth' of the monitored directory is at most 1 deep:
If you monitor C:\Monitor and a file arrives in c:\monitor\limit it will work, but for files
arriving in c:\monitor\limit\deeper it will cause problems:
WD_RELDIR will be set to "limit\deeper" for them, causing this line to fail:

Code:
ECHO SENTINEL > "C:\Temp\%WD_RELDIR%_%DT_DATE%.sentinel"
 



To prevent that your C:\Temp directory will be filled with those sentinel files after a few weeks,
you could add this to the .bat file at a strategic place:
Code:
GdPUtil -deleteolderthan 7 c:\temp
 


to automatically delete ALL (!!!) files older than 7 days from c:\temp

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



Posts: 10
Re: Limiting Notifications
Reply #4 - Aug 18th, 2004 at 10:04pm
 
Naturally, Murphy’s Law takes place in my case.  I have 3 directories that have a depth of 3 (c:\monitor\limit\deeper).  Are there any solutions, or am I out-of-luck?
Back to top
 
tendayrain1  
IP Logged
 
markklass
YaBB Newbies
*
Offline



Posts: 10
Re: Limiting Notifications
Reply #5 - Aug 18th, 2004 at 10:32pm
 
Can i simply replace %WD_RELDIR% with %WD_FILE%  ?

Sounds too trivial....
Back to top
 
tendayrain1  
IP Logged
 
Gert
YaBB Administrator
*****
Offline



Posts: 2225
The Netherlands
Re: Limiting Notifications
Reply #6 - Aug 18th, 2004 at 10:43pm
 
No, WD_FILE won't work.
The problem is, in case you didn't get it, that WD_RELDIR contains backslashes (\) if the directory is deeper than 1 level.
So, the line
Code:
ECHO SENTINEL > "C:\Temp\%WD_RELDIR%_%DT_DATE%.sentinel" 


will expand to, for example
Code:
ECHO SENTINEL > "C:\Temp\limit\deeper_20040818.sentinel" 


which would bomb if the directory c:\temp\limit would not exist.

I guess it should work if you create the appropriate sub-directories in c:\temp (limit in this example).

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



Posts: 10
Re: Limiting Notifications
Reply #7 - Aug 19th, 2004 at 1:06am
 
Works great.  I created the appropriate sub-directories in C Temp.   Thanks,  I wish every business worked like you guys!!!
Back to top
 
tendayrain1  
IP Logged
 
Gert
YaBB Administrator
*****
Offline



Posts: 2225
The Netherlands
Re: Limiting Notifications
Reply #8 - Aug 19th, 2004 at 3:04am
 
Quote:
,  I wish every business worked like you guys!!!

Smiley thanks.
I guess you also have 'not so nice' experiences trying to contact big companies. I really hate it that the only way to contact them is by some form that automatically looks up the most appropriate answer in their faq and send that to you.

And if you at last seem to be talking/emailing with a human being (by carefully wording your messages so it won't trigger a faq response), it is either
a sales person (who knows nothing about the product)
or
a guy from some offshore "service" center (who knows nothing about the product)
or
some freshly recruited schoolboy (who knows nothing about the product)

Some of those companies even require you to pay them for reporting bugs in their software.

Please visit (see address on http://www.gdps.dk/contact.shtml) and shoot me if I ever pull tricks like that.

AAAAAHHH, that feels good.
(did you notice I just tried to contact my ISP).

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
 
Page Index Toggle Pages: 1