Skip to content

Instantly share code, notes, and snippets.

@happy-coding
Created October 19, 2012 10:11
Show Gist options
  • Save happy-coding/3917306 to your computer and use it in GitHub Desktop.
Save happy-coding/3917306 to your computer and use it in GitHub Desktop.
Monitor a directory for new files and do something with them
inotifywait -m /home/user/files -r -q -m -e CREATE 2>&- | awk '$2 == "CREATE" { print $3; fflush() }' |
while read file; do
echo "$file"
# do something with the file
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment