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

String substitution help

New Here ,
Aug 14, 2012 Aug 14, 2012

Copy link to clipboard

Copied

We purchased a large batch of design assets and began to rename them.  After much thought we decided we would like to keep the original file names based on the fact that we can search the provider (shutterstock) which would make them easier to find in our DB.  I need help removing the text we've added and reverting to the original file names.  Examples below.

Current name:

baby_feet shutterstock_9193737.jpg

stars shutterstock_1018373.eps

we simply want to drop everything prior to the "shutterstock" and keep everything the same after.  We would like the follows to look as shown below.

shutterstock_9193737.jpg

shutterstock_1018373.eps

thanks in advance for any advice on how to fix this blunder

TOPICS
Scripting

Views

3.5K

Likes

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 1 Correct answer

Community Expert , May 16, 2022 May 16, 2022

I can't see your full file names, but I think this will do what you want:

Find: ^(\_)(\w+)(\_)

Replace: blank

 

gregreser_0-1652713761753.png

 

Another approach: if you want to remove the same number of characters from the beginning of all the file names (in your case, 12), you could do this:

Find: ^(.{12})

Replace: blank

 

gregreser_1-1652714366237.png

 

Likes

Translate

Translate
Guru ,
Aug 14, 2012 Aug 14, 2012

Copy link to clipboard

Copied

Have you looked at using Bridge's batch rename…? It now has regexp & string subbing… You also have the opportuinity to store previous name in file XMP when renaming…

Likes

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
New Here ,
Aug 14, 2012 Aug 14, 2012

Copy link to clipboard

Copied

Yes,

Familiar with it, but unfamiliar with the needed text or text string to remove the titles shown above and simply leave the last portion.

Likes

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
Guru ,
Aug 14, 2012 Aug 14, 2012

Copy link to clipboard

Copied

Well this could be done with script or the built-in Batch Rename function… Much depends on where all these files are?

Screen shot 2012-08-14 at 20.30.38.png

This should give you what you want… ^ matches beginning of line . the dot matches any character the + makes the dot greedy then \s matches space… Replace with nothing… Hope that makes sence…?

Likes

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
New Here ,
Aug 14, 2012 Aug 14, 2012

Copy link to clipboard

Copied

Doesn't make sense at all...but it worked!

Thanks for the amazing time saver.

Likes

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
Valorous Hero ,
Aug 14, 2012 Aug 14, 2012

Copy link to clipboard

Copied

As always there is more than one way, another would be to use:-

[^shu]*

In the find field, this get everything upto shu. Leave the replace with blank.

Likes

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
Guru ,
Aug 14, 2012 Aug 14, 2012

Copy link to clipboard

Copied

I does make total sense… If you don't want to learn or have the time for script do learn reguar expressions ( GREP )… Bridge ( rename ) & InDesign ( find & replace and styles ) make use of these pattern matches… Very cool stuff… and yes Paul lots of ways to skin a cat I do like that… but it takes a little practice…

Likes

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
Explorer ,
Feb 04, 2016 Feb 04, 2016

Copy link to clipboard

Copied

I could kiss you! Thank you so much!

Likes

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
Participant ,
May 16, 2022 May 16, 2022

Copy link to clipboard

Copied

I have a similar issue but I don't understand the find functions. The Photoshop export layers to files function add a load of unwanted prefix numbering to the files.

 

Do you know what string substitution I should need to use to remove a sequence like so:

 

Screenshot 2022-05-16 at 15.36.04.png

 

I can remove _0000s_00 by simply adding that, but how do I do the entire sequences between the underscores in one clean sweep?

 

It would save me a lot of messing about.

 

Thanks

Will

Likes

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 ,
May 16, 2022 May 16, 2022

Copy link to clipboard

Copied

I can't see your full file names, but I think this will do what you want:

Find: ^(\_)(\w+)(\_)

Replace: blank

 

gregreser_0-1652713761753.png

 

Another approach: if you want to remove the same number of characters from the beginning of all the file names (in your case, 12), you could do this:

Find: ^(.{12})

Replace: blank

 

gregreser_1-1652714366237.png

 

Likes

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 ,
May 18, 2022 May 18, 2022

Copy link to clipboard

Copied

LATEST

@Monoboy - if the answer works for you please mark the reply as a correct answer, thanks.

 

EDIT (21/05): I did it for you.

Likes

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