I have a fswatch set up on a directory which triggers a script to refresh my browser every time a file is changed. It works but if there is a bunch of files added or deleted in a single shot, the browser can refresh for very long periods of time before it stops.
Looking at the documentation, it looks like --batch-marker might but what I need but it's not clear from the documentation how I might use it to limit how many times my script is triggered.
UPDATE: here is my current fswatch command:
fswatch -v -o . | xargs -n1 -I{} ~/bin/refresh.sh
UPDATE: I'm on a mac using the FSEvents monitor.