Page 1 of 1
Run a rule periodically

Posted:
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!
Re: Run a rule periodically

Posted:
Fri May 21, 2021 11:01 am
by Mr_Noodle
Try using the "Current time" attribute.
Re: Run a rule periodically

Posted:
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!
Re: Run a rule periodically

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

Posted:
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?

Re: Run a rule periodically

Posted:
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?
Re: Run a rule periodically

Posted:
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!