"capture" a date in a text pattern and rename like YYYYMMDD

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

Moderator: Mr_Noodle

Hi, I'm used to download some bank documents once or twice a year. They have not the right date contained in the metadata cause they are generated by the system as i download them: the reference date is in the filename.

I'd like to catch the date contained in the filename and convert it in the YYYYMMDD format.

filename ex LQ06-LQ_ E_C SCALARI / 28_02_2021 .pdf

Can Hazel get the date in the filename and then rename the file for ex 20220401_everything.pdf?

My rule catch the date correctly in the filename but I can't figure how to instruct hazel to perform the rename, cause Hazel catch it yes but like a text pattern not a date.

thank you

-m
bellamerighi
 
Posts: 10
Joined: Sat Dec 08, 2018 5:57 am

Look up match patterns in the help. You can use a custom date attribute to do what you want.
Mr_Noodle
Site Admin
 
Posts: 11235
Joined: Sun Sep 03, 2006 1:30 am
Location: New York City

Yes, I did it in conjunction with hazel's live preview: name matches (…)(day_month_year)(…) and it's ok, Rule matches.

So I have matched the date in the filename. Now, the question is how have I to set up hazel to rename the file with the date in format YYYYMMDD?

thank you.

-m
bellamerighi
 
Posts: 10
Joined: Sat Dec 08, 2018 5:57 am

If you created a custom date token, then in the Rename pattern, look at the list of attributes available. The custom date attribute should be there. Drag that into your pattern, then click on it. There will be an option to edit its format.
Mr_Noodle
Site Admin
 
Posts: 11235
Joined: Sun Sep 03, 2006 1:30 am
Location: New York City

OMG it works! In the Rename field I've used my custom data token, then "Edit Date Pattern" and rearranged them in the yyyy_mm_dd format.

solved.

thank you

-m
bellamerighi
 
Posts: 10
Joined: Sat Dec 08, 2018 5:57 am


Return to Support