I'd like to ignore a directory that has not been created at the time I start inotifywait. I have an empty directory test:
ubuntu@foo:~$ ls -lah test/
total 8.0K
drwxrwxr-x 2 ubuntu ubuntu 4.0K Sep 5 20:00 .
drwxr-x--- 13 ubuntu ubuntu 4.0K Sep 5 19:56 ..
I start inotifywait like this:
ubuntu@foo:~$ inotifywait -mr -e CREATE -e MODIFY -e DELETE -e MOVE /home/ubuntu/test/ @/home/ubuntu/test/log
Setting up watches. Beware: since -r was given, this may take a while!
Watches established.
Then, in another terminal, I create a directory log and put some content there:
ubuntu@foo:~/test$ mkdir log
ubuntu@foo:~/test$ cd log/
ubuntu@foo:~/test/log$ echo "foo" > foo
This is the inotifywait output:
/home/ubuntu/test/ CREATE,ISDIR log
/home/ubuntu/test/log/ CREATE foo
/home/ubuntu/test/log/ MODIFY foo
However, if I close the script and start it again and put some more content into the file, no events are triggered.
Is it possible, to ignore a "soon to be created"-directory in inotifywait?