Stop processing after matching first file

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

Moderators: Mr_Noodle, Moderators

I want to have Hazel via Applescript add a reminder to clean out my download folder if there's a file that is more than 1 week old. How do I get Hazel to only process the first matching file? If I have 10 files in my download folder that are older than 1 week I only want my Applescript to run one.

Thanks, Scott.
scottfwalter
 
Posts: 47
Joined: Thu Jan 03, 2013 11:10 am

I thought I would have my rule set the label color to "red" and then have a second rule ignore all the files that have a red label. During the first pass my rule that runs the applescript to create a reminder execute multiple times.

I guess Hazel must get the list of files to process before any rules are run for the folder. It would be nice if you could force a re-evaulation of rules.
scottfwalter
 
Posts: 47
Joined: Thu Jan 03, 2013 11:10 am

Why don't you have Hazel monitor one level up and then match the folder if it contains a file that meets your criteria. That way you only have the action run on the folder as a whole and not on each file?
Mr_Noodle
Site Admin
 
Posts: 11551
Joined: Sun Sep 03, 2006 1:30 am
Location: New York City

Thanks for the tip I was able to get it to work. In case anyone else wants something like this here is a screenshot of my rule https://www.dropbox.com/s/xgi5invks5q80rs/hazel%20rule.png
scottfwalter
 
Posts: 47
Joined: Thu Jan 03, 2013 11:10 am


Return to Open Discussion