Usage
fswatch
accepts a list of paths for which change events should be received:
$ fswatch [options] ... path-0 ... path-n
The event stream is created even if any of the paths do not exist yet. If they
are created after fswatch
is launched, change events will be properly
received. Depending on the watcher being used, newly created paths will be
monitored after the amount of configured latency has elapsed.
The output of fswatch
can be piped to other program in order to process it
further:
$ fswatch -0 path | while read -d "" event \
do \
// do something with ${event}
done
To run a command when a set of change events is printed to standard output but no event details are required, then the following command can be used:
$ fswatch -o path | xargs -n1 -I{} program
The behaviour is consistent with earlier versions of fswatch
(v. 0.x).
Please, read the Compatibility Issues with fswatch v. 0.x section for further
information.
By default fswatch
chooses the best monitor available on the current platform,
in terms of performance and resource consumption. If the user wishes to specify
a different monitor, the -m
option can be used to specify the monitor by name:
$ fswatch -m kqueue_monitor path
The list of available monitors can be obtained with the -h
option.
For more information, refer to the fswatch
documentation.