Skip to main content
jaimep70636492
Participant
Oct 8, 2020 3:20 PM UTC
Question

Remove leading zeros from filenames

How can I use string substitution to batch remove leading zeros from filenames? For example, I want to change 2020_001_002 to 2020_1_2. 

This topic is closed to new replies. Start a new post to keep the conversation going.

3 replies

Stephen Marsh
Community Expert
Community Expert
Oct 9, 2020 9:03 AM UTC

In it's simplest form, one does not even need a regular expression, a simple find/replace for 00 is all that is required.

 

 

Of course, if there are double zero digits in the filename that do need to be retained, then you need to introduce a regular expression based pattern match.

Translate
Legend
Oct 8, 2020 6:52 PM UTC

You can use regular expressions. /00/g would find all instances of "00" in files.

 

https://www.regular-expressions.info/

Translate
gary_sc
Community Expert
Community Expert
Oct 8, 2020 6:44 PM UTC

Hi Jaime,

 

Within Bridge I do not think so. However, if you are on a Mac you can use the application "A Better Finder Rename" which can use Regular Expressions.

 

see: https://medium.com/@johnlreed/a-better-finder-rename-and-regular-expressions-7f0b9645a002

 

Not sure it helps you but it might get your thoughts going

Translate