Page 1 of 1

Remove leading zeros from filename

PostPosted: 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!

Re: Remove leading zeros from filename

PostPosted: Thu Dec 07, 2017 11:48 am
by Mr_Noodle
Are the zeros part of a larger number? Can you provide example filenames?

Re: Remove leading zeros from filename

PostPosted: 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!

Re: Remove leading zeros from filename

PostPosted: 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.