Page 1 of 1

running rule once only

PostPosted: Thu Feb 03, 2011 3:14 pm
by boywithk9
I have a folder that I want to keep synced via Transmit FTP. From time to time, a batch of files gets automatically copied into this folder all at once. I have Hazel set up to watch the folder and run an Automator workflow when the contents of the file change (Date Last Modified Is After Date Last Matched). The Automator workflow connects to a Transmit favorite and syncs (uploads) all newer files.

The problem is that the workflow runs once for each of the changed files in the folder, so I end up in Automator hell. Is there a way to have Hazel only run the rule once, even though the folder contains many files that match the rule?

Re: running rule once only

PostPosted: Fri Feb 04, 2011 2:53 pm
by Mr_Noodle
Not really. You can set a rule to match and run on the folder as a whole instead but otherwise, you'd have to do your own script or something to coordinate to have it only run once.

Re: running rule once only

PostPosted: Sat Feb 05, 2011 11:35 am
by boywithk9
When you say "You can set a rule to match and run on the folder as a whole", how do I do that?

Thanks

Re: running rule once only

PostPosted: Sun Feb 06, 2011 4:45 pm
by dhy8386
Well what's unique about your automator script? Why not have hazel move to folder on FTP site?

What he means is have a rule that checks to see if the folder has been modified vs the contents. Like I folder size changes then run the Automator
Script on the whole folder processing the files

Re: running rule once only

PostPosted: Sun Feb 06, 2011 5:15 pm
by boywithk9
Thanks for your input.

Well what's unique about your automator script? Why not have hazel move to folder on FTP site?


The automator script tells Transmit to sync the contents of the folder to a folder on the FTP site. I have it set up so Hazel watches the folder that contains the files, and when <Date Last Modified> <is in the last> <5 minutes>, the automator script is invoked.

What he means is have a rule that checks to see if the folder has been modified vs the contents. Like I folder size changes then run the Automator Script on the whole folder processing the files


I thought that's what I was doing (in fact, I thought Hazel only monitors folders, not files in the folders). The problem is that because several files are being placed in the folder at once, Hazel is getting triggered once for each of the files.

I'm sure I'm missing something obvious, but when you say "have a rule that checks to see if the folder has been modified vs the contents", isn't that all Hazel does?

Re: running rule once only

PostPosted: Mon Feb 07, 2011 10:38 pm
by dhy8386
No. Hazel monitors everything. Files and folders. Its up to the user to scale it back.

Ok. I think it would be better if you tell us all your rules (in detail each one). Its hard to help when not sure exactly what you have done.

For instance, lets say the folder that is being synced (the one that is modified every so often) is called downloads. If you select that folder and then run a rule that says, if date last modified is in the last, its going to look at all files inside the folder and then run the subseqent action (in your case an automator script).

Instead. Lets say you have the Downloads folder in another folder called Meta. And make it the only folder in Meta. Now choose Meta as the folder to monitor in hazel and then for conditions if you choose kind is folder and date last modified is in the last 5 minutes, and then action is your automator script, it will now be monitoring just the folder vs the folder contents.

Make sense?

You can always test what is happening in Hazel by using the preview. Open up the rule you created and at the bottom of the window, next to the minus sign, you will see a gear icon. Click on it and then choose preview rule. That will show you what files/folders are matching your rule.