WatchDirectory Forum
http://www.watchdirectory.net/cgi-bin/yabb25/YaBB.pl
watchDirectory forums >> How to... >> How to control time watchdir updates file
http://www.watchdirectory.net/cgi-bin/yabb25/YaBB.pl?num=1095739133

Message started by btfsc on Sep 21st, 2004 at 11:58am

Title: How to control time watchdir updates file
Post by btfsc on Sep 21st, 2004 at 11:58am
Is there a way to have watchDirectory only update the mointored dir during certain hours ?
The program we are watching does an update every 10 seconds with or without data change.After approx 1500
no new data is gathered but we are still uploading the update via FTP. Would like to be able to set a time such as 0900 to 1500 for watchDirectory to update then suspend updating till the next time frame.

Thanks
Bill

Title: Re: How to control time watchdir updates file
Post by Gert on Sep 21st, 2004 at 12:40pm
Hello Bill,

You can probably add something to your .bat file to do that.
If you download/install our free GdPUtil program (http://www.gdps.dk/products/watchDir/GdPUtil.shtml) and add the following to the beginning of your .bat:

[code]d:\Bin\GdPUtil.exe -datetime c:\temp\dt.bat
call c:\temp\dt.bat
del c:\temp\dt.bat
rem extract the first and second position from the hour
SET H1=%DT_HOUR:~0,1%
SET H2=%DT_HOUR:~1,1%

if %H1% == 0 GOTO :EarlyMorning
rem so it is 10  or later here
IF %DT_HOUR% GEQ 15 GOTO :QUIT
GOTO :AllOk
:EarlyMorning
rem the hour is in the range 00 - 09
IF %H2% LEQ 8 GOTO :QUIT
:AllOk
[/code]

The reason I 'split' the DT_HOUR variable above, is because arithmetic on the command prompt will thing it contains an octal number when it starts with a zero.

Hope this helps,
Gert

Title: Re: How to control time watchdir updates file
Post by Gert on Sep 22nd, 2004 at 3:23am
Another thought ...
If the program that updates the file always ADDS data to it, or does something else making the filesize change,  there is a watchDirectory setting that makes it detect file-changes based on filesize instead of the (default) last-write time.

Gert

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