25 lines
458 B
Plaintext
25 lines
458 B
Plaintext
|
#!/usr/bin/env ruby
|
||
|
require 'rubygems'
|
||
|
require 'rb-inotify'
|
||
|
|
||
|
folders = Array.new
|
||
|
notifier = INotify::Notifier.new
|
||
|
|
||
|
notifier.watch(ARGV.first || '.', :modify, :recursive) do |event|
|
||
|
dir = File.expand_path(File.dirname(event.absolute_name)) + '/'
|
||
|
if !folders.include?(dir)
|
||
|
folders << dir
|
||
|
end
|
||
|
end
|
||
|
|
||
|
while true do
|
||
|
notifier.process
|
||
|
|
||
|
if !folders.empty?
|
||
|
$stdout.puts folders.join(' ')
|
||
|
$stdout.flush
|
||
|
folders.clear
|
||
|
end
|
||
|
|
||
|
sleep(0.1)
|
||
|
end
|