Page 1 of 1

Rename date format of files question

PostPosted: Tue Jul 17, 2012 10:28 am
by pbain
Can Hazel rename files changing the date format? For example, I have several files with the following naming convention:

Smith Letter Jul04-12.pdf

I would like to change these to a new naming convention:

2012-07-04 Smith Letter.pdf

I'm not sure if Hazel can do this with its renaming features. Any thoughts?

Re: Rename date format of files question

PostPosted: Tue Jul 17, 2012 2:08 pm
by a_freyer
pbain wrote:Can Hazel rename files changing the date format? For example, I have several files with the following naming convention:

Smith Letter Jul04-12.pdf

I would like to change these to a new naming convention:

2012-07-04 Smith Letter.pdf

I'm not sure if Hazel can do this with its renaming features. Any thoughts?



Yup - click the white arrow on the right side of the date token you are using in the renaming field. You'll see a dropdown with "Edit Date Pattern..."

Re: Rename date format of files question

PostPosted: Tue Jul 17, 2012 2:41 pm
by pbain
How do I delete the old date convention from the file name?

Re: Rename date format of files question

PostPosted: Tue Jul 17, 2012 3:29 pm
by Mr_Noodle
To do this, you need to use match patterns and custom tokens (search the help on these).

You basically, want to create custom tokens to match the month, day and year. While re-using the date and year from the original file name shouldn't be an issue, translating the month from a textual name to a number is tricky. Hazel just knows that you capture the month as a bunch of text; it doesn't know that it's a month. One thing you can do is after you drop your custom month token into the rename pattern, click on it and do "Replace Text...". From there, you need to provide replacements of month names to years, like "Jul -> 07".

If you have questions about the above, reply back.

Re: Rename date format of files question

PostPosted: Tue Jul 17, 2012 3:32 pm
by pbain
Works great! Thank you.

Re: Rename date format of files question

PostPosted: Sat Jan 26, 2013 1:16 pm
by Phred
Would you be willing to share the setup you created that works? Maybe a screenshot?

Being a newbie, this would be of great help! Thanks.

Re: Rename date format of files question

PostPosted: Fri Apr 14, 2023 11:56 am
by gacorrea
Mr_Noodle wrote:To do this, you need to use match patterns and custom tokens (search the help on these).

You basically, want to create custom tokens to match the month, day and year. While re-using the date and year from the original file name shouldn't be an issue, translating the month from a textual name to a number is tricky. Hazel just knows that you capture the month as a bunch of text; it doesn't know that it's a month. One thing you can do is after you drop your custom month token into the rename pattern, click on it and do "Replace Text...". From there, you need to provide replacements of month names to years, like "Jul -> 07".

If you have questions about the above, reply back.


How would I use Hazel to reformat the filenames of any files that may land in my Downloads folder containing an embedded date in the format mm-dd-yy to look like: YYYY-MM-DD {rest of original filename except the mm-dd-yy date}.

Example: Bank statements downloaded from bank websites often are named {Bank name} statement mm-dd-yy.pdf
I'd like to automatically reformat these filenames to YYY-MM-DD {Bank name} statement.pdf

Re: Rename date format of files question

PostPosted: Mon Apr 17, 2023 3:44 am
by Mr_Noodle
Have you checked the manual for "match patterns"?