Search code examples
bashfiletriggershookmove

Trigger a script when a file is moved in a folder (Linux)


What's the best way to trigger a bash script automatically when a file is moved in a folder ? (I'm working in a Linux environment)

I don't want to use a cron job that checks every minutes my folder.


Solution

  • Try inotify-tools or fileschanged. These programs can be used to monitor and act upon filesystem events.

    https://github.com/rvoicilas/inotify-tools/wiki
    
    http://fileschanged.sourceforge.net/