Incode Systems Home Page Incode Systems, Inc.


(Windows 95 or higher command line utility)

FNotify is a batch file utility designed to allow construction of an efficient batch file for processing files which are added to a directory.

Normally such a batch would need to periodically check for files it is designed to process using IF EXIST. This is very inefficient because the computer is using processor time to check for these files even when none exist. FNotify uses the Windows File Change Notification API which uses no processor time while it is waiting for a change to occur in the directory it is monitoring, but responds immediately when the change occurs.

Many home printers do not allow sharing the printer on a network. The batch below allows network users to print to a file that will automatically be sent to the printer. Note that the -timeout option is used with FNotify and the batch detects the timeout and runs whatever is specified. This allows the batch to perform some other task periodically (in this example, every 5 minutes). The batch is designed to look for a file with the reserved name $Exit.flg. This is a signal for the batch to end. Any number of such reserved file names could be used to signal actions to be performed.

FNotify -timeout:5m .\
IF EXIST $Exit.flg GOTO Quit :FileLoop
REM Rename the first PRN file to $.prn
REN *.prn $.prn
COPY /B $.prn PRN
DEL $.prn
GOTO FileLoop

REM Do whatever you want to happen on timeout here

DEL $Exit.flg
REM Do whatever you want to happen when exit signal is sent


Program usage:

FNotify - Copyright (C) 2009-2013, Incode Systems, Inc.

Usage: [options] Path

FNotify waits for one of the changes specified to occur in
the Path given. FNotify exits with ERRORLEVEL 0 if change detected.
Path is the directory to monitor. To monitor the working
directory, use .as the Path.

FNotify uses File Change Notification to report changes,
so it uses virtually no processor time while waiting and exits
virtually immediately when the change is detected.

-s Monitor subdirectories
-FileName Monitor file name changes (default)
-FileName- Do NOT Monitor file name changes
-DirName Monitor directory name changes
-Attribs Monitor file attribute changes
-Size Monitor file size changes
-LastWrite Monitor LastWrite timestamp changes (default)
-LastWrite- Do NOT Monitor LastWrite timestamp changes
-Security Monitor file security changes
-timeout:n n is the number of milliseconds to timeout
default is 0, which waits forever.
n may end in s for seconds, m for minutes, h for hours.

FNotify exits with ERRORLEVEL 0 if the change indicated by the
options occurs.
ERRORLEVEL 1 if time out.
ERRORLEVEL 2 if User exits with Ctrl-C, Ctrl-Break, or System logout, etc.
ERRORLEVEL 3 if Path not found (or File not found).
10000 is added to OS error codes to avoid collision with other codes.

The default 0 timeout causes FNotify to wait forever for the
change specified. In this case, exit the program with Ctrl-C or Ctrl-Break.
To cause the program to exit programmatically, just create a change
in the monitored directory and check for that change in the batch file.

Note: LastWrite is triggered only when the timestamp update is
written to the disk and may be delayed by caching.

Version 1.0.2
mailto:sales1To see complete usage, type FNotify /? | more