I want to trigger an action, when in one of my specified directories, a new file is created. I want to use inotifywait for this purpose. But the problem is that I don't know how to use inotifywait to watch several directories simultaneously. Watching a single directory even recursively is not a problem, but several? Is it possible, or must I run several processes with "inotifywait" in parallel?

1 Answer 1


You can just list directories you want to observe:

$ inotifywait testdir1 testdir2/ -m

Inside application, after instance of inotify is created using inotify_init() function, inotify_add_watch() can be called several times for selected paths. You can find the system limit of watching paths in /proc/sys/fs/inotify/max_user_watches (8192 by default).

  • THX You for help
    – mackowiakp
    Commented May 15, 2014 at 19:35

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .