Rename file and remove recognized date in name

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

Moderator: Mr_Noodle

Hello, everybody,

I have a little challenge changing the file name with Hazel.

In my rule I want Hazel to replace the date recognized in the filename with new defaults.

Here is the example
Original file:
20200317 filename.pfd or
2020_03_17_filename.pdf


Current change
2020-03-17 20200317 filename.pdf
2020-03-17 2020_03_17_filename.pdf

Desired change
2020-03-17 filename.pdf

Maybe someone here can help me.

Thanks a lot.
MrPlunder
 
Posts: 2
Joined: Thu Mar 19, 2020 4:44 am

Look up "match patterns" in the help. Using those, you can use a custom date token to match the date part and a custom text attribute to match everything after that. You can then use those in the Rename action, re-formatting the custom date attribute to suit your tastes.
Mr_Noodle
Site Admin
 
Posts: 11193
Joined: Sun Sep 03, 2006 1:30 am
Location: New York City

yes, that makes sense and works.

But I can't get it if a date is already in the filename and I just want to adjust it.

For example:

filename input: 2020-03-10 Noodlesoft.pdf move to
filename outgoing from Hazel: 2020_03_10 Noodlesoft.pdf

Current outgoing from Hazel:
2020_03_10 2020-03-10 Noodelsoft.pdf

current Outgoing setting:
1_date modified_1 2_name_2 3_extended_3
1_2020_03_10_1 2_2020-03-10 Noodelsoft_2 3_.pdf_3
MrPlunder
 
Posts: 2
Joined: Thu Mar 19, 2020 4:44 am

If you use custom attributes to match the parts of the file, then in the Rename action, you use those custom attributes, and not date modified or name or any of the built-in attributes.
Mr_Noodle
Site Admin
 
Posts: 11193
Joined: Sun Sep 03, 2006 1:30 am
Location: New York City


Return to Support