Adding a numerical value to a non-sequential batch?

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

Adding a numerical value to a non-sequential batch?

Postby archer73 » Sat Mar 30, 2013 6:25 am

Hi, folks--

Brand new here, but couldn't find my question in the forum, so here goes:

Can I add a specific value to a non-sequential numeric suffix in a file? For example, if my files are
IMAGE001
IMAGE002
IMAGE017
IMAGE034

Can I add a value of 25 to each, such that...

IMAGE001 becomes IMAGE026
IMAGE002 becomes IMAGE027
IMAGE017 becomes IMAGE042
IMAGE034 becomes IMAGE059?

The problem I've found is that if my files are not sequentially consecutive, when I rename them by adding a value they consequently become consecutive. In other words...

IMAGE001 becomes IMAGE026 (this is okay)
IMAGE002 becomes IMAGE027 (this is okay)
IMAGE017 becomes IMAGE028 (this is not okay)
IMAGE034 becomes IMAGE029 (this is not okay)

Thus, the numeric difference between the suffix of "2" and the suffix of "17" becomes one, whereas I would like it to remain at "15" (the difference between 17 and 2). Am I doing something wrong?

Thanks!

-Greg
archer73
 
Posts: 1
Joined: Sat Mar 30, 2013 6:06 am

Re: Adding a numerical value to a non-sequential batch?

Postby Stefan » Sun Mar 31, 2013 12:02 am

Can I add a specific value to a non-sequential numeric suffix in a file?
Can I add a value of 25 to each, such that...

IMAGE001 becomes IMAGE026
IMAGE002 becomes IMAGE027
IMAGE017 becomes IMAGE042
IMAGE034 becomes IMAGE059



Yes, you can do that by utilizing the "Renaming From A Text File" feature

old name | new name



To get the new names
you can use a spreadsheet tool
like already mentioned e.g. in this older thread
http://www.bulkrenameutility.co.uk/forum/viewtopic.php?p=4120#p4120


For your case, to increase a number, do this steps in an spreadsheet:

Column A: IMAGE001.jpg
The original name:
In BRU select all files and use context menu > Clipboard Copy > "FileName + Ext"
Then open e.g. Excel and paste this list to column A


Column B:
i have left empty for no real reason, but i keep it here too since i have already taken the screen shot


Column C: =left( A1 ; len(A1) - 7 )
Name part without trailing 3 digits number:
Take whole name from left till 7 from the right (number + dot + extension => 3+1+3=7)
>> IMAGE


Column D: =right( left( A1 ; len(A1) - 4 ) ; 3 )
Number only without leading chars:
Take whole name from left without right 4 (dot + ext) >> IMAGE001
and from that the last 3 from the right (the number) >> 001

Column E: =right( "000" & D1 + 25 ; 3)
Add value of "25" to each number:
Put a lot of leading zeros plus the origin number as in column D "001", plus the addition "25", >> 0001 >> 0026
then take the last 3 from the right only >> 026


Column F: =right( A1 ; 4 )
Get the extension:
Take the right 4 of the original name (dot + ext) >> .jpg


Column G: =A1 & "|" & C1 & E1 & F1
Glue all together:
Old Name "A1", plus pipe symbol '|' for BRU, plus Name part "C1", plus new number "E1", plus extension "F1"
>> IMAGE001.jpg|IMAGE026.jpg



See a picture
http://imageshack.us/photo/my-images/827/excelbruincreasenumber.png/


Next select the G column and copy and paste it to an text file for "Renaming From A Text File" BRU option.

IMAGE001.img|IMAGE026.img
IMAGE002.img|IMAGE027.img
IMAGE017.img|IMAGE042.img
IMAGE034.img|IMAGE059.img


I have done the code to work with different name part lengths too:
IMAGE abc 001.img|IMAGE abc 026.img
IMAGE defgh 002.img|IMAGE defgh 027.img
IMAGEijkl 017.img|IMAGEijkl 042.img
IMAGEmnop034.img|IMAGEmnop059.img

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


Return to BRU Support