WatchDirectory Forum
http://www.watchdirectory.net/cgi-bin/yabb25/YaBB.pl
watchDirectory forums >> How to... >> E-Mail according to directory
http://www.watchdirectory.net/cgi-bin/yabb25/YaBB.pl?num=1092666521

Message started by markklass on Aug 16th, 2004 at 10:28pm

Title: E-Mail according to directory
Post by markklass on Aug 16th, 2004 at 10:28pm
Hello all,

I need watchDirectory to monitor an FTP folder, and send an e-mail according to which directoy has activity.  

How can I configure watchDirectory to send an email to a different person depending on which folder has been modified?

Also,

I keep getting two messages when there is a change.
One indicating, that 'The monitored directory has detected a change."  How can I remove that?

Title: Re: E-Mail according to directory
Post by Gert on Aug 17th, 2004 at 12:10am
Hello Mark,

There are a lot of ways to make the recipient of the email message more flexible.
Just as an example, you could create a recipient file in each monitored directory. Inside that file place a list of people you want to send a notification to,
Lets assume you monitor C:\Monitor and want john@mail.com and pete@mail.com to receive notifications for directory c:\monitor\hello.

Create the file C:\monitored\hello\recip.txt and put those email-adresses inside it (one per line).

Now change your wdautomail.bat....
almost at the end of this .bat file there is a line:

Code (]IF NOT "%BLATTO%" == "" SET BLTCMD=%BLTCMD% -to %BLATTO%
[/code):


Change that to
[code]SET BLTCMD=%BLTCMD% -tf "%WD_FILE_D%\recip.txt"


That should do the trick.
You could get even smarter, by checking if recip.txt does exist, and if not use a default from somewhere else.


Quote:
that 'The monitored directory has detected a change."  How can I remove that?

You probably told watchDirectory to fire DIRCHNG events. If you deselect that option, it won't send those messages.


Hope this helps,
Gert

Title: Re: E-Mail according to directory
Post by markklass on Aug 17th, 2004 at 3:06am
Gert,

I did the following....
Are there any repercussions?


GdPUtil -matches "%WD_FILE_D%" "C:\Inetpub\ftproot\optimedia*"
IF %ERRORLEVEL% == 1 SET BLATTO=xxx@mail.com

Title: Re: E-Mail according to directory
Post by Gert on Aug 17th, 2004 at 3:33am
Good idea, should work fine.
Just remember that this will also match

C:\Inetpub\ftproot\optimedia\and\some\other\dir\below

Gert

Title: Re: E-Mail according to directory
Post by zzerek on Jun 17th, 2005 at 4:39am
Is there anyway to reflect the folder name on the email which is being modified or has a new file being transferred?  Email only gives users the new file name.  It does not show which folder/customer is sending the file.  I have several users which have multiple folder ownership.

Thanks in advance

Title: Re: E-Mail according to directory
Post by Gert on Jun 17th, 2005 at 4:47am
Yes,

If you want to have the complete filename (including the path) in the subject line you need to search inside the script for lines like:
[code]SET SUB="A new file is created: %WD_FILE_N%"[/code]
(There are several SET SUB=... lines in the script).
%WD_FILE_N% is "translated" to just the filename, if you change it to %WD_FILE% (without the _N) it will be translated to the complete path.

Other %variables% you can use are listed here:
http://www.watchdirectory.net/watchDir/help/bat.html

Gert

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