WatchDirectory Forum
http://www.watchdirectory.net/cgi-bin/yabb25/YaBB.pl
watchDirectory forums >> How to... >> WD_FILE_D not available when QUIET alert
http://www.watchdirectory.net/cgi-bin/yabb25/YaBB.pl?num=1133443261

Message started by unixrulemas on Dec 1st, 2005 at 2:21pm

Title: WD_FILE_D not available when QUIET alert
Post by unixrulemas on Dec 1st, 2005 at 2:21pm
Hi guys,

I am new to the forum.

When monitoring a directory with hundreds of subfolders, is there a way to obtain WD_FILE_D environment variable?...i understand that this will not work since there is not file that trigger the alert, but i am looking for a way to perform QUIET monitoring on the main directory and use a variable to alert me of the specific folder. I do not want to create a task for every subfolder which is the only way i have seen it working.

Thanks.

Title: Re: WD_FILE_D not available when QUIET alert
Post by Gert on Dec 1st, 2005 at 4:36pm
You will have to add a little trick inside your .bat script for that.
Let watchDirectory call this script:
[code]
rem call for the monitored directory itself
SET WD_FILE_D=%WD_DIR%
Call "C:\path to your real bat\file.bat"

rem call for all subdirectories
FOR /D %%I in ("%WD_DIR%\*.*") DO Call :NewSubDir "%%I"
GOTO :EOF

:NewSubDir
rem call for this subdirectory
SET WD_FILE_D=%1
Call "C:\path to your real bat\file.bat"
GOTO :EOF
[/code]

The above will only call your .bat for directories directly below the monitored directory. Let me know if you need the sub-sub-sub-sub-directories as well.

Hope this helps.

Gert
[modified: typo in the code]

Title: Re: WD_FILE_D not available when QUIET alert
Post by unixrulemas on Dec 1st, 2005 at 9:27pm
Thank you...but it does not get me there. I was hoping to get alerts on the QUIET subfolder and not from the main one. I have a very simple eventcreate command which uses this variable value to send me alerts. I may just have to create events for each. Thank you very much for the help.

Title: Re: WD_FILE_D not available when QUIET alert
Post by Gert on Dec 1st, 2005 at 9:48pm
I see, I misunderstood.
Sorry, that's not directly possible with WD.

Gert

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