emcrisostomo / fswatch

A cross-platform file change monitor with multiple backends: Apple OS X File System Events, *BSD kqueue, Solaris/Illumos File Events Notification, Linux inotify, Microsoft Windows and a stat()-based backend.
https://emcrisostomo.github.io/fswatch/
GNU General Public License v3.0
5.04k stars 328 forks source link

Using fswatch without recursion option fires for files in subdirectories #266

Open beesperester opened 3 years ago

beesperester commented 3 years ago

I am using this command to watch changes to my cwd for files ending in .py and for the sake of this example simply echoing the resulting file path. Since I am not providing the -r option I would expect that only files which are direct children of my cwd will be echoed, but it still will fire for .py files in subdirectories of my cwd.

OS: macOS 10.15.7

fswatch --exclude ".*" --include "\.py$" --verbose ./ | while read f ; do echo $f; done

Feuermurmel commented 3 years ago

FYI, the manual states under 4.14 Recursive Scanning:

The semantics of the (--recursive, -r) option is: recursively scan subdirectories. However, implementations may silently add ‘if the monitor does not do so already’. Since each monitor uses a different API, its behaviour depends on that of the backing API, and it is monitor-specific.