• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Batch Name Change

Guide ,
Sep 14, 2021 Sep 14, 2021

Copy link to clipboard

Copied

Hi all. I do grocery ads, and I have to download lots of product art, and each piece is named for the SKU number, which is typically 25 characters in length. The company I work for only wants to use 5 characters from the name (which are located in the middle), because it's easier to find when placing in InDesign. For example, I want to change:

00073105704203_CF__JPEG_3.jpg

to

70420_CF.jpg

I used to use a program that would let me enter a number of characters to delete from a file name, and I could choose to delete them from the front or the back, so I would cut 8 off of the front, then 12 off of the back, and I could click a check box to add a suffix to keep the _CF in the name. Pretty useful when you need 200-300 images in an ad.

The problem is that the program doesn't work in Big Sur, and the new version that does is by monthly subscription, and my boss is frugal. Does anyone know if Bridge can do this? I've looked at the Batch Rename, and I can't work out how to do it. Thanks in advance.

TOPICS
Batch , How to

Views

519

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 2 Correct answers

Community Expert , Sep 14, 2021 Sep 14, 2021

Sorry, I didn't notice that you need on less character before "_CF"

I found that I could add a second parameter using "intermediate filename" which made the edit in a single pass.

Then I added a third parameter to add "_CF".

I think this works:

gregreser_2-1631682565580.png

 

 

 

Votes

Translate

Translate
Community Expert , Sep 16, 2021 Sep 16, 2021

Another way, using a single command is to use capture groups:

 

Find:

(^.{8})(.{5})(.)(.{3})(.+)

Replace:

$2$4

 

There are many other variations on the theme. Bridge usually looks after filename extensions, however, if you wanted to explicitly include them:

 

Find:

(^.{8})(.{5})(.)(.{3})(.+)(\.[^\.]+$)

Replace:

$2$4$6

Votes

Translate

Translate
Community Expert ,
Sep 14, 2021 Sep 14, 2021

Copy link to clipboard

Copied

You can use batch rename with string substitution and regular expression in Bridge to do this.

I found a way to do it in two separate operations. Perhaps someone else here can suggest a way to combine them into a single operation.

Step 1: remove first 8 characters

^.{8}

gregreser_0-1631674577922.png

 

Step 2: remove the last 12 characters

.{12}$

gregreser_1-1631674679840.png

 

 

 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guide ,
Sep 14, 2021 Sep 14, 2021

Copy link to clipboard

Copied

Thanks, that's very helpful. The first pass removed the 8 characters I wanted from the front, but the second pass left 4 of the characters I wanted to delete at the end. I changed the Find to .{16}$ and it got all 12 characters in the second pass. Do you know why that is?

 

I'm going to play with it for a while and see if I can get it to work in one pass, but if anyone knows how and wants to post it, I'd appreciate it. I'd also like to add 3 characters back in at the end to have 12345_CF.jpg, so if I can do all 3 in one go, that would be best.

 

Thanks again, and I'll mark your answer correct in a few days when I think we have all of the answers.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Sep 14, 2021 Sep 14, 2021

Copy link to clipboard

Copied

Sorry, I didn't notice that you need on less character before "_CF"

I found that I could add a second parameter using "intermediate filename" which made the edit in a single pass.

Then I added a third parameter to add "_CF".

I think this works:

gregreser_2-1631682565580.png

 

 

 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Sep 16, 2021 Sep 16, 2021

Copy link to clipboard

Copied

Another way, using a single command is to use capture groups:

 

Find:

(^.{8})(.{5})(.)(.{3})(.+)

Replace:

$2$4

 

There are many other variations on the theme. Bridge usually looks after filename extensions, however, if you wanted to explicitly include them:

 

Find:

(^.{8})(.{5})(.)(.{3})(.+)(\.[^\.]+$)

Replace:

$2$4$6

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guide ,
Sep 17, 2021 Sep 17, 2021

Copy link to clipboard

Copied

Steven, thank you so much. This does what I need for this particular text string in one pass, so I will be able to use it for most of what I need. I will need to modify it for some other image names that have other character counts, so I wonder if you can direct me to a source to understand how the code works. Is it the same as or similar to grep code (which I barely understand, but I could benefit from learning). Maybe just what terms to search for.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Sep 17, 2021 Sep 17, 2021

Copy link to clipboard

Copied

LATEST

@Migintosh 

 

Bridge uses the term "Regular Expression" and InDesign uses "GREP" (Global Regular Expression Print), they are both essentially "the same thing" for most practical end user concerns in Adobe Software.

 

There are different flavours, if you are looking for something that works with Adobe apps I'd look for PCRE (Perl compatible regular expression). If you are scripting in JavaScript, then you would need to take into account minor differences with ECMAScript or other programming languages.

 

There are many "tester" websites which are live/interactive, which are fantastic for learning and testing:

 

https://regex101.com/

https://regexr.com/

https://www.regextester.com/

 

If you search the internet using the term "regular expression" you will find countless tutorials, examples, videos etc.

 

Have fun and good luck!

 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines