2016-08-21 13:03:49 +02:00
|
|
|
# fswatch
|
|
|
|
|
|
|
|
> A cross-platform file change monitor.
|
2019-06-07 11:58:16 +01:00
|
|
|
> More information: <https://emcrisostomo.github.io/fswatch>.
|
2016-08-21 13:03:49 +02:00
|
|
|
|
2021-08-15 19:59:09 +02:00
|
|
|
- Run a Bash command on file creation, update or deletion:
|
2016-08-21 13:03:49 +02:00
|
|
|
|
2025-04-22 15:48:30 +03:00
|
|
|
`fswatch {{path/to/file}} | xargs {{[-n|--max-args]}} 1 {{bash_command}}`
|
2016-08-21 13:03:49 +02:00
|
|
|
|
|
|
|
- Watch one or more files and/or directories:
|
|
|
|
|
2025-04-22 15:48:30 +03:00
|
|
|
`fswatch {{path/to/file}} {{path/to/directory}} {{path/to/another_directory/**/*.js}} | xargs {{[-n|--max-args]}} 1 {{bash_command}}`
|
2016-08-21 13:03:49 +02:00
|
|
|
|
2018-05-23 04:33:25 +02:00
|
|
|
- Print the absolute paths of the changed files:
|
2016-08-21 13:03:49 +02:00
|
|
|
|
2025-04-22 15:48:30 +03:00
|
|
|
`fswatch {{path/to/directory}} | xargs {{[-n|--max-args]}} 1 -I _ echo _`
|
2016-08-21 13:03:49 +02:00
|
|
|
|
2021-08-15 19:59:09 +02:00
|
|
|
- Filter by event type:
|
2016-08-21 13:03:49 +02:00
|
|
|
|
2025-04-22 15:48:30 +03:00
|
|
|
`fswatch --event {{Updated|Removed|Created|...}} {{path/to/directory}} | xargs {{[-n|--max-args]}} 1 {{bash_command}}`
|