I am using inotifywait to monitor a folder by using below way.
inotifywait -m /tmp/test -e CLOSE_WRITE -e MOVED_FROM --format '%T' --timefmt '%s' -q|<action> In here if any change in /tmp/test i want to do an action.
For example if deleted two files it fires MOVED_FROM event, but i want to call only an action once. If it again modify i wan to fire the same action.
I tried to get the time. And try to get a uniq . But it did not work.
Please let me know any one experience this.
inotifywait ... | uniqdoesn't work because of buffering; you need to line-bufferuniqto let it print the time of events as long as they're piped to it).rm foo barunlinksfooandbarseparately. I don't think there is a way forinotifywaitto know whether you executedrm foo barorrm foofollowed byrm bar.