Rename with file numbers in parentheses?

Post any Bulk Rename Utility support requirements here. Open to all registered users.

Rename with file numbers in parentheses?

Postby hawks28 » Sat Dec 27, 2008 3:10 am

Hello. I'm guessing there is an easy way to do this, but I'm just not seeing it.

I would like to rename photos to the following pattern. I figured out how to get 2008-12-24 and Christmas into the filename, but can't figure out how to get parentheses into the filename.

IMG_1001.JPG
IMG_1002.JPG
...
IMG_1099.JPG

to

2008-12-24 Christmas (1).JPG
2008-12-24 Christmas (2).JPG
...
2008-12-24 Christmas (99).JPG

Thanks in advance for your help!
hawks28
 
Posts: 2
Joined: Sat Dec 27, 2008 3:07 am

Re: Rename with file numbers in parentheses?

Postby GMA » Sun Dec 28, 2008 12:21 am

Hi, hawks28:
You can use the following regular expression:

RegEx(1):
MATCH: (IMG_1)([0]*)(.*)
REPLACE: 2008-12-24 Christmas (\3)

Happy new year,

Gabriel.
GMA
 
Posts: 91
Joined: Sun Dec 02, 2007 1:30 pm
Location: Argentina

Re: Rename with file numbers in parentheses?

Postby hawks28 » Mon Dec 29, 2008 3:55 am

Thanks!

Quick follow up question...how would I pad the numbers in parentheses.

E.g., Photo (001).jpg, Photo (002).jpg, .... Photo (999).jpg
hawks28
 
Posts: 2
Joined: Sat Dec 27, 2008 3:07 am

Re: Rename with file numbers in parentheses?

Postby GMA » Tue Dec 30, 2008 4:37 am

Well, if you've already renamed your files (i.e. from "IMG_1001.JPG" to "2008-12-24 Christmas (1).JPG", etc.), you're gonna need two steps. The first step...

RegEx(1):
MATCH: (.*)(\()([0-9])(\))
REPLACE: \1\200\3\4

...to rename all single-digit numbers from (X) to (00X). And then a second step...

RegEx(1):
MATCH: (.*)(\()([0-9]{2})(\))
REPLACE: \1\20\3\4

...to rename all double-digit numbers from (XX) to (0XX)

----------------------------------------------------------

If your files still have their original names ("IMG_1001.JPG", etc.), just use the following expression instead of the one from my first post:

RegEx(1):
MATCH: (IMG_1)(.*)
REPLACE: 2008-12-24 Christmas (\2)

Cheers,

Gabriel.
GMA
 
Posts: 91
Joined: Sun Dec 02, 2007 1:30 pm
Location: Argentina


Return to BRU Support