A class for monitoring events related to files and directories.  This
package is deprecated in favor of win32-changejournal on NTFS filesystems.


* ffi
* win32-ipc
* win32-event


gem install win32-changenotify


require 'win32/changenotify'
include Win32

# Indefinitely wait for a change in 'C:\some\path' and any of its
# subdirectories.  Print the file and action affected.

filter = ChangeNotify::FILE_NAME | ChangeNotify::DIR_NAME
path   = 'C:\some\path'

cn =, true, filter)

cn.wait{ |arr|
  arr.each{ |info|
    p info.file_name
    p info.action


# OR, true, filter) do |events|
  events.each{ |event|
    p event.file_name
    p event.action


The Win32::ChangeNotify class is a subclass of Win32::Ipc, and thus has
all of its methods available as well.

This library is deprecated in favor of win32-changejournal on NTFS

Known Issues

Despite the improvements yielded as a result of using completion ports,
it's still possible that events could be missed. To be more precise,
any events that occur in the fraction of a second between the call to
GetQueuedCompletionStatus() and ReadDirectoryChangesW() in the wait loop
will not get picked up. As a general rule, the faster your system is,
the less likely you are to encounter this scenario.

With Ruby 2.x and JRuby this should be even less of an issue than it's
been in the past.


This class was originally based on the Win32::ChangeNotify Perl module by
Christopher Madsen.

Future Plans

Probably none. This library is deprecated in favor of win32-changejournal.
However, that library only works on NTFS filesystems, so this library will
be maintained as well.

That being said, I'm always open to improvements, so feel free to submit
ideas and patches.

Known Bugs

None that I know of. Please report any issues on the project page at:


Artistic 2.0


(C) 2003-2013 Daniel J. Berger, All Rights Reserved


This package 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.


Park Heesob
Daniel J. Berger