Created
October 19, 2012 10:11
-
-
Save happy-coding/3917306 to your computer and use it in GitHub Desktop.
Monitor a directory for new files and do something with them
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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