Run a rule periodically

Get help. Get answers. Let others lend you a hand.

Moderator: Mr_Noodle

Run a rule periodically Fri May 21, 2021 9:45 am • by scottjl
Can someone point me in the right direction, I can't seem to figure this out.

I want to set up a rule to run once a week, say every Monday at 9am, and empty out the contents of a specific folder. I don't care about the age of the file, when it was created, its type, anything. I know I could easily set this up in cron, but I'd like to use Hazel. I've tried using "Date last matched" but that only removes files a week old.

Is there a way to do this in Hazel?

Thanks!
scottjl
 
Posts: 4
Joined: Fri May 21, 2021 9:40 am

Re: Run a rule periodically Fri May 21, 2021 11:01 am • by Mr_Noodle
Try using the "Current time" attribute.
Mr_Noodle
Site Admin
 
Posts: 11195
Joined: Sun Sep 03, 2006 1:30 am
Location: New York City

Re: Run a rule periodically Fri May 21, 2021 11:15 am • by scottjl
Mr_Noodle wrote:Try using the "Current time" attribute.


Ah. I don't know how I missed that.

Tell me, if I set a rule for 9am, and I don't wake my Mac or turn it on until 10am, will the rule run to catch up or be skipped until the following week?

Thanks again!
scottjl
 
Posts: 4
Joined: Fri May 21, 2021 9:40 am

Re: Run a rule periodically Mon May 24, 2021 10:34 am • by Mr_Noodle
No, it will only match within a window of a few minutes of 9am.
Mr_Noodle
Site Admin
 
Posts: 11195
Joined: Sun Sep 03, 2006 1:30 am
Location: New York City

Re: Run a rule periodically Mon May 24, 2021 10:36 am • by scottjl
Mr_Noodle wrote:No, it will only match within a window of a few minutes of 9am.


Ah, "catch up on missed events" feature request? :D
scottjl
 
Posts: 4
Joined: Fri May 21, 2021 9:40 am

Re: Run a rule periodically Mon May 24, 2021 10:38 am • by Mr_Noodle
I'll consider it though I'd also have to take into consideration cases like if it misses multiple opportunities, does it fire multiple times in quick succession?
Mr_Noodle
Site Admin
 
Posts: 11195
Joined: Sun Sep 03, 2006 1:30 am
Location: New York City

Re: Run a rule periodically Mon May 24, 2021 10:48 am • by scottjl
hmm.. i'd be inclined to say no, and leave it an option to catch up or not. maybe put a limits like "catch up if missed by XX hours" and "catchup up XX times". certainly an 'advanced option' because of the risk of causing trouble.

thanks for the assistance though!
scottjl
 
Posts: 4
Joined: Fri May 21, 2021 9:40 am


Return to Support