Forrest logo
back to the inotifywait tool

inotifywait:ai:586d1

How to re-run a command when files in a directory are updated
$ inotifywait -m ${directory} -e modify -e create -e delete | while read -r directory event file; do ${YOUR_COMMAND_HERE}; done
try on your machine

This command uses inotifywait to monitor a specific directory for file updates. When a modification, creation, or deletion occurs, it will trigger the specified command to be re-run.

This explanation was created by an AI. In most cases those are correct. But please always be careful and never run a command you are not sure if it is safe.

Questions that are answered by this command:

  • How to re-run a command when files in a directory are updated?
back to the inotifywait tool