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
Iscriviti a Post [Atom]