Skip navigation
tch_adobe
Currently Being Moderated

Advanced Batch Rename using RegEx?

Mar 19, 2013 4:23 AM

Hi all,

 

I've got hundreds of files to rename, they're all images of vehicles that have been named based on their reg, there are 8 images per vehicle denoted by the number 1-8 immediately after the reg nuber.

 

What I need to do is insert a _ between the end of the reg, and the number at the end (1-8), I've had a look around to find a regular expression to try to do this in the string substitution option. But can't find one anywhere, and can't for the life of me figure it out myself because this is the first time I've ever seen regex etc.

 

All I need to do is select the last character of each file name, any ideas. Example:

 

Currently named:

 

BX59AHB1

 

Needs to be:

 

BX59AHB_1

 

All the registrations are different, and on the end of each is number either from 1 to 8. Any help would be greatly appreciated because it will takes hours to go through them one by one.

 

Cheers.

 
Replies
  • Currently Being Moderated
    Mar 19, 2013 6:49 AM   in reply to tch_adobe

    The string substitution in batch rename does not do the job?  Can find this in the New Filenames dropdown box.

     
    |
    Mark as:
  • Currently Being Moderated
    Mar 19, 2013 7:28 AM   in reply to tch_adobe

    This should work…? My test had file extension… '.psd'

     

    Screen shot 2013-03-19 at 14.23.48.png

     
    |
    Mark as:
  • Currently Being Moderated
    Mar 19, 2013 7:49 AM   in reply to tch_adobe

    It looks like the Batch Rename concats from the bottom-up… So the regexp…

     

    ^.{7} The ^ indicates the beginning of line… the . (dot) matches almost any character… the braces {7} and number match 7 of the anything…

     

    is just concat using the text option…

     

    \d\.psd  \d matches one digit \. matches an actual dot the psd are just actual character match…

     
    |
    Mark as:
  • Currently Being Moderated
    Mar 19, 2013 8:30 AM   in reply to Muppet Mark

    Muppet Mark,

     

    Very nice.  I am too old to follow your logic.  I see the ^ indicates beginning of line, but what line?   Confused with the {7} entry also.

     

    Will this search for all .psd files on D drive and replace original name with existing name +  _1?

     
    |
    Mark as:
  • Currently Being Moderated
    Mar 19, 2013 9:01 AM   in reply to Curt Y

    Regular expressions are very useful stuff and NOT just to scripters… You should be able to do much more with Bridge's Batch Rename now that it has this addition.

     

    There is only 1 line of text in a file name you may not actually need the ^

     

    No the files will not all end up with an _1 the expression \d matches any digit [0-9] which 1 thru 8 are part of… So it will put whatever digit was in that position back…

     

    http://www.regular-expressions.info/reference.html

     
    |
    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points