Remove leading zeros from filename

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

Moderator: Mr_Noodle

Remove leading zeros from filename Thu Dec 07, 2017 10:23 am • by Chris58
I have a rule to move files from one folder to another. I would also like Hazel to rename the files — removing any leading zeros from the file name. Any ideas?

I also have the app Better Rename 9, if that helps.

Thanks!
Chris58
 
Posts: 2
Joined: Thu Dec 07, 2017 10:21 am

Re: Remove leading zeros from filename Thu Dec 07, 2017 11:48 am • by Mr_Noodle
Are the zeros part of a larger number? Can you provide example filenames?
Mr_Noodle
Site Admin
 
Posts: 11872
Joined: Sun Sep 03, 2006 1:30 am
Location: New York City

Re: Remove leading zeros from filename Thu Dec 07, 2017 12:20 pm • by Chris58
Mr_Noodle wrote:Are the zeros part of a larger number? Can you provide example filenames?


Thanks for response. So, for example:

0138 (2015-01-09) [rest of filename].pdf

I'd like to make it:

138 (2015-01-09) [rest of filename].pdf

Thanks!
Chris58
 
Posts: 2
Joined: Thu Dec 07, 2017 10:21 am

Re: Remove leading zeros from filename Fri Dec 08, 2017 12:14 pm • by Mr_Noodle
You can try using a custom attribute to match the first number. Then when using it in your Rename pattern, you can specify the number of digits for the number. This only really works, though, if the numbers (without the zeroes) have the same number of digits.
Mr_Noodle
Site Admin
 
Posts: 11872
Joined: Sun Sep 03, 2006 1:30 am
Location: New York City


Return to Support