Help request with "any change in directory"

Talk, speculate, discuss, pontificate. As long as it pertains to Hazel.

Moderators: Mr_Noodle, Moderators

Help request with "any change in directory" Sun Feb 17, 2013 8:40 am • by hans602
Hi,

I have a simple need: monitor a directory for any changes underneath. As soon as *anything* changes OR *many things* have changed (file rename, addition, deletion, ...) I want to run some bash script (to sync the directory).

Note that I want the bash script to run once, not for each and every change that occurs, i.e. if three file names have changed, I want the script to be run once, *not* have it called three times(!)

Background info:
What I want to achive with this is to keep two directories in sync. For your information: I do use Chronosync, the Chronosync script runs once an hour (it does not support instant-sync, only scheduled sync). In between, when I am working in a directory, I want individual file changes to trigger the sync almost instantly after a change. Note that Hazel's sync is not good, it offers no bi-directional sync. So please, please don't start a discussion on syncing, but keep this topic to the question mentioned above "how to detect change(s) in a directory with hazel". The main problem is that I don't want Chronosync to run 50 times when 50 files change, just once will do the job.
hans602
 
Posts: 1
Joined: Sun Feb 17, 2013 8:28 am

Check my post here: http://www.noodlesoft.com/forums/viewtopic.php?f=4&t=1593&p=6500&hilit=sync+rule#p6500. Just replace the sync action with your script. Note that it only checks for changes at one end. If you have Hazel watching the other end, things can get a bit hairy.
Mr_Noodle
Site Admin
 
Posts: 11193
Joined: Sun Sep 03, 2006 1:30 am
Location: New York City


Return to Open Discussion