Find character and replace

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

Moderator: Mr_Noodle

Find character and replace Sat Jul 18, 2020 6:45 am • by goat
Hello,

Apologies if this was posted already, I've been looking at previous posts and could not find the answer to my specific case.

I have a naming convention that goes like this: YYMMDD_aa_whatever the detail of this file.xyz

Example
200719_bw_meeting dinner invoice.pdf

The issue
Often I receive files that use either "_" or "-" as separators. I do not want that in my naming convention. In the example above it would look like.

200719_bw_meeting-dinner_invoice.pdf

What I want to achieve
200719_bw_meeting dinner invoice.pdf

So Hazel should find all of the "_" and "-" after the initial match of YYMMDD_aa_ and replace these with an empty space.

It was easy for me to define the initial match YYMMDD_aa_ I have no idea how to tell Hazel: if after the initial match you find underscores or hyphens then replace with an empty space.

Thanks!
goat
 
Posts: 9
Joined: Fri Mar 06, 2020 7:38 am

Re: Find character and replace Mon Jul 20, 2020 10:06 am • by Mr_Noodle
Try the Replace text feature. Create a custom attribute to match the end part of the name. When using it in the Rename action, click on it. You should see the Replace text option in the menu there.
Mr_Noodle
Site Admin
 
Posts: 11870
Joined: Sun Sep 03, 2006 1:30 am
Location: New York City


Return to Support