Match folder name to current date as condition

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

Moderator: Mr_Noodle

Hey,

I have been reading the manual, looking at the test rules, and searching this forum for something that I think should be easy (and feel like a total newbie for having to ask):

Is there a way in which I can set as a condition that a folder name should match today's date, before its contents is processed?

My use case, in a nutshell: I have digital tickler files, and want to move – every morning of every day - all documents in the tickler folder that matches today's date to my inbox folder. For example, tomorrow morning I want all files that reside in the folder 20190108 to be moved out of that folder into my inbox folder. The tricky part: these files could have been moved any day into that folder: today, last week, three weeks ago, half a year ago. So none of the date options – date created, date last modified, date last opened, date last matched - helps, it seems to me at least (after trying them all out).

All I would need is a condition along the lines of "Kind is folder" and "Name of the folder matches today's date (in a specific format)". And for the life of me I cannot figure this out…

Any pointers, hopefully not too embarrassing?
nonformality
 
Posts: 2
Joined: Mon Jan 07, 2019 11:09 am

Check the chapter on match patterns in the help. You can use a custom date attribute. That date attribute can then be used on the left hand side of a condition so you can do "<the date attribute> is Today". You can then do "Run rules on folder contents" to have Hazel go into that folder. You would then need more rules to process the files inside.
Mr_Noodle
Site Admin
 
Posts: 7759
Joined: Sun Sep 03, 2006 1:30 am
Location: New York City

Thank you! That helped, and I got it to work.

One related question for understanding: the format of Today () is always YYYYMMDD? Or can that somehow be influenced? So far, I can only get it to work with that exact pattern – which is not a problem, it's just out of curiosity (and because it has an influence on my workflow).
nonformality
 
Posts: 2
Joined: Mon Jan 07, 2019 11:09 am

"Today" doesn't have any sort of pattern since it's not derived from text. Formats are only needed to translate from text to a date. Once as a date, it's just a date representing a point in time without any sense of format.
Mr_Noodle
Site Admin
 
Posts: 7759
Joined: Sun Sep 03, 2006 1:30 am
Location: New York City


Return to Support

cron