0

我需要使用 inotifywait 来监视文件夹。进入该文件夹的文件可能非常大,这就是我使用 close_write 并等待文件完成写入的原因。但是,我还希望在同一文件夹下重命名文件时触发事件。那么我应该注意什么事件来进行文件重命名呢?我查看了 inotifywait 手册页,但没有找到我要查找的内容。inotify IN_MOVED_TO 事件似乎是我需要的,但这不是 inotifywait。

我也尝试了moved_to,但首先,文件重命名时它没有触发事件;其次,如果我同时拥有 close_write 和moved_to,则可能会在触发close_write 之前触发moved_to,以防文件非常大。谢谢。

 inotifywait --monitor --event close_write --format '%w%f %e %T' --timefmt '%F %T' $watchFolder 
   |  while read eventOutput
 do
    echo "eventOutput is:" $eventOutput
 done
4

0 回答 0