hannobraun / inotify-rs

Idiomatic inotify wrapper for the Rust programming language
ISC License
254 stars 64 forks source link

Recursive Directory Watching #216

Closed Chaqua closed 5 months ago

Chaqua commented 5 months ago

Is there a way to watch a directory inside a directory inside a directory and so on.

e.g

Because currently, I am only able to watch dir1, and if smth changes in dir2 or dir3 I dont get an event. Do I just have to add a watcher to each directory myself, or is there a function for that already I missed?

hannobraun commented 5 months ago

From the inotify man page:

Inotify monitoring of directories is not recursive: to monitor subdirectories under a directory, additional watches must be created.

You might want to consider using Notify, which provides a convenient API for watching directories recursively, and uses inotify under the hood on Linux.