Help Swapping around characters

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

Help Swapping around characters

Postby swood » Fri Feb 18, 2011 5:32 pm

I currently have files names similar to this one:

522072NE_OR_20100911_0.50_RGB.tif

I would like to rename the files to the below format

NE72-22-5_OR_20100911_0.50_RGB.tif

Note that only 522072NE changed to NE72-22-5, also note that the 0 is removed.

Any help would be greatly appreciated. Thanks in advance. :D
swood
 
Posts: 2
Joined: Fri Feb 18, 2011 5:23 pm

Re: Help Swapping around characters

Postby Stefan » Fri Feb 18, 2011 9:50 pm

FROM:
522072NE_OR_20100911_0.50_RGB.tif
TO:
NE72-22-5_OR_20100911_0.50_RGB.tif

You may use regular expressions like:
(based on your single example string!!! YMMV)

Match: "5" >> (.) match any sign, only one piece, store in group \1
Match: "22" > (..) match any sign, two pieces, store in group \2
Match: "0" >> . dot match one single sign, don't store it
Match: "72" > (..) group \3
Match: "NE" > (..) group \4
Match: "_OR_20100911_0.50_RGB" >> (_.+) match an underscore followed by one-or-more of any sign, group \5

Then use what is matched in the groups as backrefernces in the replace field, adding dash your own as needed.

DO:
Use RegEx(1)
Match: (.)(..).(..)(..)(_.+)
Repla: \4\3-\2-\1\5

.
Stefan
 
Posts: 736
Joined: Fri Mar 11, 2005 7:46 pm
Location: Germany, EU

Re: Help Swapping around characters

Postby swood » Sat Feb 19, 2011 12:24 am

Thank you for you help! :D :D
swood
 
Posts: 2
Joined: Fri Feb 18, 2011 5:23 pm


Return to BRU Support


cron