Skip to main content
Participating Frequently
October 1, 2018
Question

batch rename search and replace a pattern in a file name

  • October 1, 2018
  • 2 replies
  • 4630 views

batch rename search and replace a pattern in a file name

input file names like:

Nominee_1999_v4_Artboard 1xxxhdpi.png

Winner_2001_v4_Artboard 1xxxhdpi.png

i would like the batch rename to be able to handle regex like partials and find and eliminate or replace a string that is consistent like '_v4_Artboard 1xxxhdpi'

This topic has been closed for replies.

2 replies

Stephen Marsh
Community Expert
Community Expert
October 3, 2018

i would like the batch rename to be able to handle regex like partials and find and eliminate or replace a string that is consistent like '_v4_Artboard 1xxxhdpi'

As Lumigraphics writes, it is all possible with a regex based string replacement, however it all depends on how loose or rigid you need the match to be… so more info is required.

In your example:

Nominee_1999_v4_Artboard 1xxxhdpi.png

Winner_2001_v4_Artboard 1xxxhdpi.png

Is it only and always the 3 characters in red that will vary (not 1 or 2 or 4 or more characters), with the bits in blue being static? Will the leading number 1 marked in green always be a number 1 or will this also need to vary by number or letter? And are the ‘xxx’ characters marked in red always going to be digits (numbers) or are they alphabetical characters or perhaps any character? For example, here are some subtle variations as examples:

Nominee_1999_v4_Artboard 1xxxhdpi.png

Nominee_1999_v4_Artboard 1xxhdpi.png

Nominee_1999_v4_Artboard 1xhdpi.png

Nominee_1999_v4_Artboard 1xxxxhdpi.png

Nominee_1999_v4_Artboard 2xxxhdpi.png

Nominee_1999_v4_Artboard Axxxhdpi.png

Nominee_1999_v4_Artboard 1234hdpi.png

Nominee_1999_v4_Artboard 2234hdpi.png

Nominee_1999_v4_Artboard 1A2Bhdpi.png

Exactly how “tight” (specific) or “loose” (flexible) do you need the regular expression to be (there are pros/cons either way)?

Participating Frequently
October 3, 2018

in this case i would like

Nominee_1999_v4_Artboard 1xxxhdpi.png

Winner_2001_v4_Artboard 1xxxhdpi.png

to become

Nominee_1999.png

Winner_2001.png

but these other variations would also be very relevant to other work ..

in the short term i did it manually .. this is more of a discussion for future work.

Participating Frequently
October 3, 2018

can someone post a screen capture of the rename interface with text/regex in the form?

Legend
October 2, 2018

Batch Rename supports regular expressions. That's going to be your best bet.