watching-files.org 766 B

Listening for file writes

Requirements

  • inotify-tools (sudo apt-get install inotify-tools)

Command

inotifywait \ --monitor \ --event \ | while read -r WRITTEN_FILE EVENTS; do printf "%s was written\n" "${WRITTEN_FILE}"; done

In the above command replace as follows:

  • ~~: the file you want to watch
  • <EVENT>~: ~'CLOSE_WRITE' for being notified when writing of the file has finished