domenica, aprile 15, 2007

 

Ruby : file system watcher

require "filesystemwatcher"
watcher = FileSystemWatcher.new()
watcher.addDirectory("/inetpub/ftproot", "*.xml")
watcher.sleepTime = 10
watcher.start { |status,file|
if(status == FileSystemWatcher::CREATED) then
puts "created: #{file}"
elsif(status == FileSystemWatcher::MODIFIED) then
puts "modified: #{file}"
elsif(status == FileSystemWatcher::DELETED then
puts "deleted: #{file}"
end
}

watcher.join() # join to the thread to keep the program alive

Etichette: ,


Commenti: Posta un commento

Iscriviti a Commenti sul post [Atom]





<< Home page

This page is powered by Blogger. Isn't yours?

Iscriviti a Post [Atom]