wood burning stoves 2.0*
The moose likes Java in General and the fly likes Monitoring File System Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "Monitoring File System" Watch "Monitoring File System" New topic

Monitoring File System

Landon Blake
Ranch Hand

Joined: Dec 04, 2003
Posts: 121
I'm looking for an open source Java application that allows me to monitor a Windows file system. Something that creates a log when files are opened, modified, moved, copied, or deleted. Does anyone have any suggestions?

If there isn't already an open source application that does this, does anyone know how I could accomplish it via Java and a Microsoft API? I would like to track changes without forcing the user to work with the file system through an independant portal. I'd like to observe and log the changes from a more passive perspective.

The purpose of this application will be to add the information about changes to files and the filesystems in a database that tracks data.


Dave Wingate
Ranch Hand

Joined: Mar 26, 2002
Posts: 262
One idea might be to skip Java all together for this task. If you're working on a Linux system, you could alias the commands in which you're interested (i.e. mv, cp rm, etc.).

You could alias these commands so that the operation is logged to a text file or database prior to running the user's request.

Fun programming etcetera!
Landon Blake
Ranch Hand

Joined: Dec 04, 2003
Posts: 121
Thanks Dave.....I wish I was working in Linux, but in this case I've got to deal with Windows. Any other ideas?
Stan James
(instanceof Sidekick)
Ranch Hand

Joined: Jan 29, 2003
Posts: 8791
There must be Windows APIs. I use several editors that alert me when the file I'm editing has been changed by another program. You'd have to use JNI to bridge between Java and a C/C++ module that uses those APIs. If you have the C and Windows skills to do that part, look for a JNI tutorial.

A good question is never answered. It is not a bolt to be tightened into place but a seed to be planted and to bear more seed toward the hope of greening the landscape of the idea. John Ciardi
Joe Ess

Joined: Oct 29, 2001
Posts: 8839

Originally posted by Stan James:
I use several editors that alert me when the file I'm editing has been changed by another program.

Ya know, Eclipse does that, and it's open source. Maybe our friend here should check out the Eclipse user and developer mailing lists and see if there's any traffic about this subject.

"blabbing like a narcissistic fool with a superiority complex" ~ N.A.
[How To Ask Questions On JavaRanch]
James Carman
Ranch Hand

Joined: Feb 20, 2001
Posts: 580
IntelliJ IDEA has a DLL file called FileWatcher2K.dll in its bin directory, which would lead me to believe that it uses JNI to accomplish this also.

James Carman, President<br />Carman Consulting, Inc.
Jeffrey Spaulding
Ranch Hand

Joined: Jan 15, 2004
Posts: 149
and then there is Perl. I remember something like that from

Perl for System Administration
Managing multi-platform environments with Perl
By David N. Blank-Edelman
1st Edition July 2000
ISBN: 1-56592-609-9

Landon Blake
Ranch Hand

Joined: Dec 04, 2003
Posts: 121
I think I need to be looking for something I can tweak to suite my purposes. Does anyone know of an open source file/directory browser written in Java? Something similar to windows explorer?


I agree. Here's the link: http://aspose.com/file-tools
subject: Monitoring File System
Similar Threads
Write a log-file parser
open a file in the external default program
Log files: Websphere
Eclipse and external editors
Portability implications for NIO