Created
August 3, 2017 08:46
-
-
Save yucer/385f63787da89aed13846ff789c1da66 to your computer and use it in GitHub Desktop.
filesystem watcher with inotify-tools
This file contains 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
# sudo apt-get install inotify-tools | |
watch_dir () | |
{ | |
inotifywait -m $1 -e create -e moved_to | while read path action file; do | |
echo "The file '$file' appeared in directory '$path' via '$action'"; | |
done | |
} | |
# usage example: | |
# | |
# $ watch_dir /tmp | |
# |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment