Can inotify allow me to monitor all files with a specific name extension no matter where they are on disk?

671 Views Asked by At

Can inotify allow me to monitor all files with a specific name extension no matter where they are on disk? For example, if I want to monitor all *.mp3 files on my device in various directories. Is it possible?

Many thanks! Amanda

2

There are 2 best solutions below

0
On

Not without setting up notification for every single directory. Consider using the auditing subsystem instead.

0
On

With pyinotify at least you could. You'd have to watch recursively at / or the directory your disk is mounted on and use the exclude_filter argument to the WatchManager.add_watch method. Maybe react https://github.com/copton/react already does all you need.