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?
Linux – “inotifywait” to watch several directories simultaneously
inotifylinux
Best Answer
You can just list directories you want to observe:
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).