Update: 2006-11-18
FolderWatcher is moving to the
Cofax Project. FolderWatcher was developed
in the mid-1990s when Java had just been released. Since then, Java technology
has progressed far, leaving the FolderWatcher code behind, but there has still
been demand for FolderWatcher. So it is being revived and moved to the Cofax
project.
FolderWatcher Version 1.5
runs as as a Unix Daemon or Windows NT service and
watches a specified folder for new incoming files or folders. As new files or folders
appear inside the folder, it uses dynamically loaded handler classes to take action on
those files and folders. This is often used to create ftp drop folders where
whenever new files come in, they are given to a processing program. This can also be used
for content replication across mirrorred servers. When one or more files in a watched
folder change, the handler class called can automatically copy them over to the mirror
servers. (Source code and instructions on installing it as a WinNT service provided.)
Download it here.
Coming soon: More examples for common FTP
drop folder uses.
Windows Service related files
- FolderWatcherService.exe (A Windows NT
Service. This is a wrapper that runs one instance of FolderWatcher to watch one
folder and run a .cmd file on the files as they arrive in the watched
folder.)
- FolderWatcher.ini
(Initialization file used by the Windows
NT Service to know which folder to watch and which batch (.cmd) file to run on
files arriving on that folder.)
- test.cmd (A sample batch file used to process incoming file.)
- README.txt
- FolderWatcherService.class
- RunCmdFileHandler.class (The
class used to run Windows NT .cmd batch files to process each file as it
arrives. Only required if using as a service on NT)
Java Classes and related files
- FolderWatcher.class
- Handler.class
- Start.class
- Util.class
- SampleShowHandler.class (A sample
handler that just displays the names of new or modified files as they appear in
the folder)
- RunLikeExe.cmd (A
WinNT command prompt script to run FolderWatcher interactively like you would
run a .exe program. The handler class used is SampleShowHandler. I use this for
testing a new handler class.
Source Code
- FolderWatcher.java
- Handler.java
- Start.java
- Util.java
- FolderWatcherService.java
- RunCmdFileHandler.java
- SampleShowHandler.java
- MAKEFILE (The MAKEFILE used by the "nmake.exe" to build the Windows service.)
Please note that the COM.rajiv packages have been renamed to com.rajiv.
It seems that most people use lowercase "com" in their java package names
rather than uppercase "COM" as Sun originally recommended.)