Hazel match logic for 3-letter month to numbered-month

I download statements that include a three-letter month abbreviation in the filename instead of a numerical month. How would I build hazel rules to convert this:

statement APR-2022.pdf

to this?

2022-04 statement.pdf

Do I build one rule per month or is there logic already built into Hazel that will do this?

when building the pattern to match the filename, add a custom date token.

Untick the Automatically detect date format and specify the format as it appears on the filename.

Once the pattern is set and you’re on the part that renames the file use the custom date token you created to be part of the filename and edit the pattern to your desired format.

5 Likes

Just spent time building pretty much exactly what you have written to be beaten by a minute :rofl: Oh well…

Thank you! This is exactly what I needed.