Rename date format of files question

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

Moderator: Mr_Noodle

Rename date format of files question 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?
pbain
 
Posts: 5
Joined: Thu Mar 31, 2011 1:04 pm

Re: Rename date format of files question 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..."
a_freyer
 
Posts: 631
Joined: Tue Sep 30, 2008 9:21 am
Location: Colorado

Re: Rename date format of files question Tue Jul 17, 2012 2:41 pm • by pbain
How do I delete the old date convention from the file name?
pbain
 
Posts: 5
Joined: Thu Mar 31, 2011 1:04 pm

Re: Rename date format of files question 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.
Mr_Noodle
Site Admin
 
Posts: 11255
Joined: Sun Sep 03, 2006 1:30 am
Location: New York City

Re: Rename date format of files question Tue Jul 17, 2012 3:32 pm • by pbain
Works great! Thank you.
pbain
 
Posts: 5
Joined: Thu Mar 31, 2011 1:04 pm

Re: Rename date format of files question 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.
Phred
 
Posts: 1
Joined: Sat Jan 26, 2013 1:13 pm

Re: Rename date format of files question 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
gacorrea
 
Posts: 5
Joined: Fri Oct 14, 2016 10:39 pm

Re: Rename date format of files question Mon Apr 17, 2023 3:44 am • by Mr_Noodle
Have you checked the manual for "match patterns"?
Mr_Noodle
Site Admin
 
Posts: 11255
Joined: Sun Sep 03, 2006 1:30 am
Location: New York City


Return to Support