Skip to content

Instantly share code, notes, and snippets.

@psqq
Forked from duese/watch-for-files.sh
Created December 30, 2015 09:03
Show Gist options
  • Save psqq/78395e743bbbb556df33 to your computer and use it in GitHub Desktop.
Save psqq/78395e743bbbb556df33 to your computer and use it in GitHub Desktop.
Looks for file changes in the current directory
#!/bin/bash
inotifywait -m $PWD -r -e create -e moved_to -e delete |
while read path action file; do
TITLE="Filesystem changed"
MESSAGE="The file '$file' appeared in directory '$path' via '$action'"
echo ${MESSAGE}
notify-send "${TITLE}" "${MESSAGE}"
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment