xurxosanz

Simple Folder Watcher

Dec 22nd, 2011
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 0.38 KB | None | 0 0
  1. #!/bin/bash
  2.  
  3. FOLDER=$1
  4. EVENTS=close_write,moved_to,moved_from,delete,delete_self
  5.  
  6. # -------------------------------------------------------
  7. # MAIN CALL TO WATCH WHAT'S GOING ON INSIDE $FOLDER
  8. # -------------------------------------------------------
  9.  
  10. inotifywait --format "%e %w%f"  -rme $EVENTS  $FOLDER | while read LINE
  11. do
  12.   echo "[`date  +%y/%m/%d-%H:%M:%S`] $LINE"
  13. done
Add Comment
Please, Sign In to add comment