There are a lot of similar posts out there, but none that does exactly what I want: I want a simple script, that watches a folder on a Mac for changes and passes the filename of the modified file to command/script when changes are detected.
The tool inotifywait
doesn't exist on a mac. Folder events or fswatch
or watchdog
seem to be getting close, but it turns out they only watch folders or only return the folder name. watchdog
might be doing what I need, but I could only find commands like this
watchmedo shell-command --recursive --command='echo ${watch_src_path}' .
which again only passes the folder name in the variable watch_src_path
. Does anyone know how to get it (or another program) to pass on the file name of the changed file?