rvoicilas/inotify-tools — pull request #28 by browndav (2013-10-18 17:21:01+00:00)
Title: For review if helpful: Add --include and --includei options mirroring --exclude and --excludei

This pull request adds an additional `invert` argument to libinotifytools' `inotifytools_ignore_events_by_regex`, which allows the ignore logic in the RETURN(A) macro to be optionally negated.

Then, in `inotifywatch` and `inotifywait`, this pull request adds `--include` and `--includei` options, allowing regular expressions typically used with `--exclude` and `--excludei` to be easily negated.

I was looking for a way to easily watch for the close-after-write of exactly one regular file named 'system' in a particular directory, and couldn't find an easy way to to effectively express "exclude everything except for the string 'system'", since there was no way to invert matches and recexec() doesn't support positive/negative lookahead assertions.

There was a thread with a similar issue here: http://stackoverflow.com/questions/7943528/inotifywait-exclude-regex-pattern-formatting

I have a patch that applies cleanly against master too, and can post it if it'd be at all helpful. I also haven't had a chance to add tests (just hacked this out last night in front of the TV), but would be willing to.

Copyright assigned to you; do what you will. :)