Download FileNotify.zip.

The UserGuide.htm file contains:

Installation
Use an administrator account for installation.

Put FileNotify.exe where you want, for example in the WINNT directory.
Type in "FileNotify.exe -install" and this is it, installation complete.
To remove FileNotify type in "FileNotify.exe -remove".
This program does not require special DLL.

If you do an upgrade from a previous version, stop the service, close Event Viewer, replace FileNotify.exe with the new version and start the service.

We chose this minimalist installation scheme because we are sure you don't like to start heavy blind installation program on your production  park. You certainly have in mind "I hope it will not upgrade a DLL that is incompatible with existing programs !"

Platforms
FileNotify is a Windows NT 4.0/3.51/2000 service that works on Server and Workstation.
For NT 3.51 you must
have SP5.
Starting and stopping
Service long name is "File Notification". Start it in the service manager program.
Service short name is filenotify, use it with net start and stop command.
net start filenotify
net stop filenotify
Parameters
All directory parameters are in FileNotify.txt file, located in the same directory as the program.
Some advanced parameters are in the registry key HKEY_LOCAL_MACHINE\Software\XTWare\FileNotify
FileNotify.txt is parse during the service start. If you edit the file, you need to stop/start the service.

To edit FileNotify.txt you can use your usual text editor, or you can use FNAdmin.exe
When starting, FNAdmin ask for the file to open for editing. If this is the first time you start it, chose cancel.
Add, Edit or Delete entry.
When finished, press OK. If you just created the file give a name to save to.

We chose text file for parameters because we find this is more convenient than registry for remote computer admin. You can also easily spread the file on your park. The txt extension take advantage of default notepad association.


FileNotify.txt
Each line in this file use the following grammar:
,,,,,


1 for File, 2 for Directory, 3 for both.


The flag tell witch event to look at.
1 = Creation
2 = Deletion
4 = Rename
8 = Modification
16 = Attributes change (read-only, archive, hidden, system)
32 = Security change
64 = Rename with long name support (see below )


0 mean no recursive directory check.
1 mean recursive directory notification.


This figure tell how many you can start simultaneously.
if if less or equal to 0 then it is replaced by 1.
For example if value is two, this mean you can have two running simultaneously, no more. If new file are added to when two instances of are already running, FileNotify wait for one of the two to stop and then start a new one.


Put a fully qualified local directory
For example c:\temp, or c:\inetpub\ftproot\advanced users\sql
Don't use double quote for path with space in.

You can specify UNC path (remote directory and syntax like \\server\share\dir1\dir2) and it should work, but not guaranteed. With UNC path FileNotify service must be started under administrator account as local system account can't do networking. UNC path have not be tested on all version of Windows. If it doesn't work with the version you work with try to apply last service pack. Behavior not determined on no Windows server (Samba, disk array...). Tell me if you test such no Windows server.
You can't use local mapped drives as services can't see these objects.


The full path to the program or batch. You can use %s to get full path to the new file.

One exception is for rename event, %s will contain the new name and the old name in that order, for example "c:\ftproot\newfile.txt c:\ftproot\oldfile.txt"
The rename2 event will use double quote separator for long name support
"c:\space directory\old file name.txt" "c:\space directory\new file name.txt"


Put comments by starting a line with a semicolon (;)

Look at the example section.


Registry

The registry path is HKEY_LOCAL_MACHINE\Software\XTWare\FileNotify

LogFile value specify the file to log to. If you need daily file add %s in name, this will be replaced by the date in yyyymmdd format. Default installation value is
For example:
c:\admin\filenotify\filenotify%s.log

Remove (or rename) this key to disable log.

EventLogFailure value specify if action failure should be trace to event log. Default value is yes (1).

LogFile format
,

Example:
04/26/1999,07:03:35,1,zip c:\temp\test.zip c:\temp\test\NewArchive.txt

always mm/dd/yyyy whatever regional settings are.

Remember that failure are also written to NT's EventLog (see EventLogFailure registry key)

General tips
  • If you need to access file on network neighborhood you must set FileNotify service to log on a Windows NT account that have this right. System account can't do network neighborhood.
  • Take care of recursivity. If the action writes in the directory is associated with you will have race condition.
  • If you have problems troubleshooting abnormal execution use the -debug option. With this option all text printed to stdout will appear as well as all interactive program window's. (FileNotify -help for more info)
  • The trigger for FileNotify to start an action is the last write-time change. Some programs change this value twice when writing a file, that's why FileNotify waits 1 second of "inactivity" on the new file before performing the action.
  • FileNotify can't monitor single file activity. You can do this easily using a batch file filter. For exemple you start "go.bat %1" and in go.bat you put a line like "if "%1"=="myfile.ext" goto action"
Example
FileNotify.txt

;Sample file for FileNotify
;
; Recursive file check starting at c:\inetpub\ftproot\database\customer list
1,1,1,1,c:\inetpub\ftproot\database\customer list,c:\inetpub\scripts\customerbcp.bat "%s"

; No recursive file check at c:\inetpub\ftproot\users
1,1,0,1,c:\inetpub\ftproot\users,0,1,c:\inetpub\scripts\zip.exe c:\temp\backup.zip %s -9

; No recursive check at c:\temp, 5 actions in parallel.
1,1,0,5,c:\temp,cmd /c copy %s \\webserver03\temp
; Directory change check (create+rename+delete)
2,1,1,1,c:\ftproot,cmd /c echo Creation %s >> c:\temp\directory.log
2,4,1,1,c:\ftproot,cmd /c echo Rename %s >> c:\temp\directory.log
2,2,1,1,c:\ftproot,cmd /c echo Delete %s >> c:\temp\directory.log

Version history
  • Version 1.3
    • Initial version.
  • Version 1.4 (11/20/99)
    • Registered version can now start if the user have no administrative rights.
  • Version 1.5 (04/27/00)
    • New FnAdmin user interface
    • Remove registration process
    • Clearer messages during installation
    • More error messages
  • Version 1.6 (07/01/00)
    • Maintenance release, no new feature.
  • Version 1.7 (11/11/00)
    • Maintenance release, no new feature.
  • Version 1.8 (07/28/01)
    • Adjust process to Backup privilege, according to Q188321
    • Delete event on files was not detected, corrected.
    • Rename event corrected
  • Version 1.9 (09/15/02)
    • Support added for Rename2 event for long file name