WatchDirectory Forum
http://www.watchdirectory.net/cgi-bin/yabb25/YaBB.pl
watchDirectory forums >> How to... >> How To... only process certain files
http://www.watchdirectory.net/cgi-bin/yabb25/YaBB.pl?num=1082183296

Message started by Gert on Apr 17th, 2004 at 2:28pm

Title: How To... only process certain files
Post by Gert on Apr 17th, 2004 at 2:28pm
If you only want to process files with a DOC extension, you need to change your .bat file to inspect the WD_FILE_E environment variable. This variable is filled by watchDirectory with the extension of the current file (or directory). This WD_FILE_E variable is always uppercase.

Code (]IF "%WD_FILE_E%" EQU "DOC" GOTO :DoIt
GOTO :EOF
:DoIt
[/code):


Note the use of "quotes" in the example above. If you do not use them and the current file has no extension, Windows will abort your .bat file due to invalid syntax.
The :EOF label is predefined for .bat files on NT based systems, GOTO :EOF causes your .bat file to exit.

By using our free program GdPUtil (http://www.gdps.dk/products/watchDir/GdPUtil.shtml) you can also use wildcard matching.
For example, if you want to process files that have a name starting with an A, and have a 2 position extension:
[code]GdPUtil -matches "%WD_FILE_N%" "A*.??"
IF %ERRORLEVEL% == 1 GOTO :DoIt
GOTO :EOF


Gert

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