【发布时间】:2014-03-25 22:41:29
【问题描述】:
代码如下:
require 'rb-inotify'
notifier = INotify::Notifier.new
notifier.watch("/path/to/folder", :moved_to, :create, :attrib, :modify) do |event|
puts "I found #{event.name}!"
end
notifier.run
该文件夹是另一个文件夹的符号链接。我想知道该符号链接何时更改。例如,我有/path/to/folder -> /link1,当它更改为/path/to/folder -> /link2 时,我需要能够分辨出来。目前我可以更改底层符号链接,并且不会记录任何事件。这可以使用 inotify 或 ruby 包装器 rb-inotify 吗?有没有更好的方法来做到这一点?
【问题讨论】: