Skip to content

Instantly share code, notes, and snippets.

@tmp27017
Last active August 29, 2015 14:07
Show Gist options
  • Select an option

  • Save tmp27017/ffed5c2be5945982a9d9 to your computer and use it in GitHub Desktop.

Select an option

Save tmp27017/ffed5c2be5945982a9d9 to your computer and use it in GitHub Desktop.
monitor folder and send mail
#!/bin/bash
inotifywait -m /path/to/folder -e modify,create -e moved_to |
while read path action file; do
echo "The file '$file' appeared in directory '$path' via '$action'" | mailx -s 'Monitor File' your_email.com
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment