2016-08-21 12:03:49 +01: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 12:03:49 +01:00
|
|
|
|
2021-08-15 18:59:09 +01:00
|
|
|
- Run a Bash command on file creation, update or deletion:
|
2016-08-21 12:03:49 +01:00
|
|
|
|
2018-05-23 03:33:25 +01:00
|
|
|
`fswatch {{path/to/file}} | xargs -n 1 {{bash_command}}`
|
2016-08-21 12:03:49 +01:00
|
|
|
|
|
|
|
- Watch one or more files and/or directories:
|
|
|
|
|
2018-05-23 03:33:25 +01:00
|
|
|
`fswatch {{path/to/file}} {{path/to/directory}} {{path/to/another_directory/**/*.js}} | xargs -n 1 {{bash_command}}`
|
2016-08-21 12:03:49 +01:00
|
|
|
|
2018-05-23 03:33:25 +01:00
|
|
|
- Print the absolute paths of the changed files:
|
2016-08-21 12:03:49 +01:00
|
|
|
|
2018-05-23 03:33:25 +01:00
|
|
|
`fswatch {{path/to/directory}} | xargs -n 1 -I {} echo {}`
|
2016-08-21 12:03:49 +01:00
|
|
|
|
2021-08-15 18:59:09 +01:00
|
|
|
- Filter by event type:
|
2016-08-21 12:03:49 +01:00
|
|
|
|
2021-08-15 18:59:09 +01:00
|
|
|
`fswatch --event {{Updated|Deleted|Created}} {{path/to/directory}} | xargs -n 1 {{bash_command}}`
|