WatchDirectory Forum
watchDirectory forums >> How to... >> How To... only process certain files

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

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 ( 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*.??"


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