Skip to content

Instantly share code, notes, and snippets.

@yucer
Created August 3, 2017 08:46
Show Gist options
  • Save yucer/385f63787da89aed13846ff789c1da66 to your computer and use it in GitHub Desktop.
Save yucer/385f63787da89aed13846ff789c1da66 to your computer and use it in GitHub Desktop.
filesystem watcher with inotify-tools
# 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