# Win32::changenotify and multiple events

**URL:** <https://www.ruby-forum.com/t/win32-changenotify-and-multiple-events/87136>\
**Category:** Ruby\
**Created:** [February 28, 2007, 1:09pm UTC](https://www.ruby-forum.com/t/win32-changenotify-and-multiple-events/87136 "2007-02-28T13:09:06Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Martin\_DeMello](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/f17d59/32.png) [@Martin\_DeMello](https://www.ruby-forum.com/u/Martin_DeMello)\
**Post date:** [February 28, 2007, 1:09pm UTC](https://www.ruby-forum.com/t/win32-changenotify-and-multiple-events/87136/1 "2007-02-28T13:09:06Z")

</div>

Could someone give me a minimal example of win32::changenotify code  
that will raise multiple events for, e.g. mkdir -p a/b/c or mv foo/bar  
baz? The following only catches one event, for instance:

require “win32/changenotify”  
include Win32

$stdout.sync = true

cn = ChangeNotify.new(“c:\”, true,  
ChangeNotify::FILE\_NAME |  
ChangeNotify::DIR\_NAME |  
ChangeNotify::LAST\_WRITE)

loop do  
cn.wait(5) {|ss|  
cn.reset  
ss.each { |s|  
puts "File: " + s.file\_name  
puts "Action: " + s.action  
}  
}  
end

martin
