The Win32 Utils team is happy to announce the first release of
win32-changejournal.
What is it?
···
===========
This is a Ruby interface for Windows change journals. A Change Journal
is a file based account of all changes to files and directories on the
NTFS file system. So long as you have an NTFS filesystem, this package
should be preferred over win32-changenotify.
Synopsis
require "win32/changejournal"
include Win32
# Indefinitely wait for a change in 'C:\' and any of its
# subdirectories. Print the file and action affected.
cj = ChangeJournal.new('C:\')
cj.wait{ |info|
p info.file_name
p info.action
}
Where is it?
It can be found on the RAA (as win32-cjournal) or on the Rubyforge
project page at http://www.rubyforge.org/projects/win32utils (where you
can also get a binary, if you prefer).
watch.wait do|info|
puts "Change Detected:"
puts "File:#{info.file_name}"
puts "Action:#{ info.action}"
$stdout.flush
end while true
------------------------8<-----------------------
Firstly, if there is something really bad I'm doing in this code, do
point it out.
What I'm observing is this:
With ChangeJournal, when I run this, I get notifications for changes
of files that are NOT under the specified directory. Another problem
is that it takes around ten seconds(or more sometimes) for it to start
noticing changes, especially if I Ctrl+C a running instance of the
program and start it again. Stuff works as expected with ChangeNotify.