Skip to main content
Known Participant
December 2, 2021
Question

Bridge 2022 - Batch Rename Using Regex

  • December 2, 2021
  • 2 replies
  • 2425 views

Hello, 

I made a post before - but I realized that I did not offer enough information and I finally figured out a bit more how to do what I am trying to do. Here is my work-flow with Bridge for running my batch rename / ideal script.

 

Step 1 - Select All Images (Control+A or Command+A)

Step 2 - Sort by Rating - Ascending Order (all of my images are ranked by either 1 star, 2 star or 3 star, I use this as a way to pick which image is the b image)

Step 3 - Run AUTO_RENAME_01 (this is just what I call my saved batch rename setting) using the attached screenshot settings. 

FIND: - ^(.{17})(.*) REPLACE: $1_b

What this is doing is basically renaming all of my images. 

From the following;

111647050986_001 BLOUSE_0490.jpg
0111647050986_001 BLOUSE_0491.jpg
0111647050986_001 BLOUSE_0492.jpg
0112439780127_080 SHRUG_0869.jpg
0112439780127_080 SHRUG_0870.jpg
0112439780127_080 SHRUG_0871.jpg

To the following;

0111647050986_001_b.jpg

0111647050986_001_b (1).jpg
0111647050986_001_b (2).jpg

0112439780127_080_b.jpg
0112439780127_080_b (1).jpg
0112439780127_080_b (2).jpg

 

Step 4 - Run AUTO_RENAME_02 (this is what I call my secondary batch rename) and its just a series of String Substitutions; as following. 

String Substitution - Original Filename

Find b (1) Replace with d

String Substitution - Intermediate Filename

Find b (2) Replace with e

String Substitution - Intermediate Filename

Find b (3) Replace with f

String Substitution - Intermediate Filename

Find b (4) Replace with g

String Substitution - Intermediate Filename

Find b (5) Replace with h

This is the end of it since I never use more images with the same code that would result in anything past h.

What this is doing is basically renaming all of my images a second time.

From the following;

0111647050986_001_b.jpg

0111647050986_001_b (1).jpg
0111647050986_001_b (2).jpg

0112439780127_080_b.jpg

0112439780127_080_b (1).jpg
0112439780127_080_b (2).jpg

To the following;

0111647050986_001_b.jpg
0111647050986_001_d.jpg
0111647050986_001_e.jpg
0112439780127_080_b.jpg
0112439780127_080_d.jpg
0112439780127_080_e.jpg

 

Here are two screenshots of the final result. Since the result is sort by rating - it shows all of the b first then e then etc. However if I re-order back to sort by filename (on the second screenshot) you can see the result is that each unique 17 digit code is followed by _d _e _f _g 

 

I hope this makes sense. My question is - will I be able to script this process? Either by writing a script that says Run AUTO_RENAMER_01 and when finished Run AUTO_RENAMER_02 (I feel like this would be the easiest way?) or would I be able to script something that uses that regex + the rating in the meta-data of the image to detone the name? 

Rating 1 - rename _b 

Rating 2 - rename _d 

Any other rating name sequentially from d so 

Rating 3 - rename e, f,g,h

etc. 

 

I hope this makes sense, I am very begginer level when it comes to scripting and this is something that I would usually get an idea on how to do via using PhotoShop script listener and studying the code it generates, but I cannot seem to find a listener version for bridge or the documentation with codes without access to the SDK / Console)

This topic has been closed for replies.

2 replies

Stephen Marsh
Community Expert
Community Expert
December 3, 2021

Why can't you just use the + sign to add another intermediate filename renaming set so that both of your separate rename steps are combined into one rename?

 

Can you provide a screenshot or a download link to the two batch rename settings?

BoluomiAuthor
Known Participant
December 3, 2021

Hi Stephen, 

 

When I tried that - I could not get it to work by building them into one but it could be that I just missed something? 

 

I have attached both of these and some sample jpgs that I use if that's helpful - not sure if we are allowed to use wetransfer? 

 

https://we.tl/t-LsYBWWwbyr

Stephen Marsh
Community Expert
Community Expert
December 3, 2021

I'll give it a look...

 

Edit: Ah, I see, you are intentionally creating duplicate filename clashes which result in a (1) or (2) etc. being created on disk, which you then leverage to create the 2nd step rename versions that use a d, e, f, g, h version. These (1) filenames are not generated in the intermediate filename.

Kukurykus
Legend
December 3, 2021

Were you able to run the code (with instruction given) I made in other thread?

BoluomiAuthor
Known Participant
December 3, 2021

I saved it down as a jsx as it was not showing up on the scrips list and still could not get it to show up. I get it to show up on the preferences but I can't seem to run it! But again, my knowled of scripting with Bridge seems to be limited. Let me re-check the other thread and see if I missed something in terms of  getting it to run.

Kukurykus
Legend
December 4, 2021