Description
A class for monitoring events related to files and directories on NTFS.
Installation
rake install (non-gem)
rake gem-install (gem)
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{ |array|
array.each{ |info|
p info.file_name
p info.action
p info.path
}
}
c.delete
Class Methods
ChangeJournal.new(drive)
Returns a new ChangeJournal object and places a monitor on +drive+.
Instance Methods
ChangeJournal#wait(num_seconds=INFINITE) ChangeJournal#wait(num_seconds=INFINITE){ |arr| … }
Waits up to 'num_seconds' for a notification to occur, or infinitely if
no value is specified.
If a block is provided, yields an array of ChangeJournalStruct's that
contains three members: file_name, action, and path. An array is returned
because multiple actions can be associated with a single event.
Constants
Standard constants
VERSION
Returns the current version number of this library as a String.
Notes
Based on what the MSDN documentation says, this library requires NTFS, and
should be preferred on that filesystem. On FAT filesystems, you should
use the win32-changenotify library instead.
Acknowledgements
This class was originally based on the CJTest module by Jeffrey
Cooperstein & Jeffrey Richter.
Future Plans
Add a method for iterating over all change records.
Known Bugs
None that I know of. Please log any bug reports on the RubyForge
project page at http://www.rubyforge.net/projects/win32utils
License
Ruby's
Copyright
(C) 2003-2008 Daniel J. Berger, All Rights Reserved
Warranty
This library is provided "as is" and without any express or
implied warranties, including, without limitation, the implied
warranties of merchantability and fitness for a particular purpose.
Authors
Park Heesob
Daniel J. Berger