Incrementally increase numbers

A swapping-ground for Regular Expression syntax

Incrementally increase numbers

Postby Dragster » Sat Aug 10, 2019 11:55 am

Incrementally increase numbers by 1.

I indeed found a post with the same question. But it was unanswered:
viewtopic.php?f=3&t=2380&start=0

Probably because there was an answer somewhere else in the forum?? :?:
I didnt found it myself

Anyway. I got always lots of images. The numbering mostly goes like
001
002
003

But sometimes I need to increment the numbering starting from 077 with 1
so 077->078
078->079
....
and so on.

Can anyone point me in the right direction / help me out?? :wink: :wink:
Dragster
 
Posts: 9
Joined: Wed May 02, 2018 4:31 pm

Re: Incrementally increase numbers

Postby therube » Sat Aug 10, 2019 3:50 pm

Assuming there is no overlap in the number of the orig/renamed sets, then ...

10:Numbering -> Prefix -> Start: 077, Pad: 3

If there is overlap, Renaming Options -> Rename in Reverse Order may help.


Depending on the existing sequence & how many numbers are in that sequence, you may need to first do something like rename Start: 001, then after that, then follow that by a Start: 077... all will depending on what you actually have at hand. Or go to the other extreme & first rename Start: 900, then after that, Start: 077.

Likewise if 001 is to be -> 077, & 002 is to be -> 078, ... then you need to make sure that your original numbers are listed sequentially 1 2 3, & not 1 3 2, because 1 3 2 would end up with 1->077, 3->078, 2,->079.
therube
 
Posts: 1314
Joined: Mon Jan 18, 2016 6:23 pm

Re: Incrementally increase numbers

Postby Dragster » Sat Aug 10, 2019 4:46 pm

I dont think this solution works.

I left out a vital piece of info I think.

Because sometimes a number is skipped and I also want to incrementally skip that number, like:

078-> 101
079->102

081-> 104
082->105

So if 080 is absent, the renumbering will skip 103 in this case.

I'm talking about series of a few hundred images wherin a few numbers are/have to be skipped.
Dragster
 
Posts: 9
Joined: Wed May 02, 2018 4:31 pm

Re: Incrementally increase numbers

Postby therube » Sat Aug 10, 2019 6:10 pm

Can you add dummy "placeholder images"?


If not, imagine you could do that with JavaScript Renaming.

Just a loop
- for i = 999 to 001
- if exist i, rename i = i+23
- next i
(but using JavaScript ;-).)
therube
 
Posts: 1314
Joined: Mon Jan 18, 2016 6:23 pm

Re: Incrementally increase numbers

Postby EbonHawk » Wed Nov 10, 2021 11:09 pm

Still no solution for this? I've tried playing around with the Numerical section and just can't get it to work. Seems like such an easy thing to do though.

Have a list:
01
02
03
04
05
06
07... and so on, and you'd like to "break" the chain and insert a number, so that (temporarily) you have:
01
02
03
04
06 (used to be 05)
07 (used to be 06)
08 (used to be 07)...

Something like an "Add 1 to numerical value" is all you need, and you could choose to increment by whatever number you choose, and what number to start with... Seems like it would fit right in with all the other features this program offers already.
EbonHawk
 
Posts: 1
Joined: Wed Nov 10, 2021 10:42 pm

Re: Incrementally increase numbers

Postby Admin » Thu Nov 11, 2021 5:13 am

Hi, there are ways to do this:

a) Use Javascript renaming but it requires a commercial license. That offers complete scripting/programming capabilities including math.

b) Export the file list to rename to Excel using BRU (right click on the files and select "Copy To Clipboard"). Change the files in Excel as needed. Import in BRU using Import-Rename pairs function (see help) and rename.
Admin
Site Admin
 
Posts: 2343
Joined: Tue Mar 08, 2005 8:39 pm

Increment numbers by 1

Postby Luuk » Thu Nov 11, 2021 8:08 am

This a link for adding with the javascript... http://www.bulkrenameutility.co.uk/foru ... 849#p13292
So if the names did only have digits, and needing to add 1, the javascript can be edited like...

if (/^\d+$/.test(name)) {
xxx=name.length // ......................xxx = How many digits are in the filename.
sum=parseInt(name)+1 // .............. sum = Add 1 to the filename (math destroys the leading-zeroes).
yyy=sum.toString().length // ........... yyy = How many digits are in the sum.
zer='0'.repeat(Math.max(0,xxx-yyy)) //zer = How many lead-zeroes is needed.
newName=zer+sum} // ................. NewName = leading-zeros in front of sum

So this how it likes to conduct the renames...
1.txt ============> 2.txt
005.txt ==========> 006.txt
0000000009.txt ===> 0000000010.txt
abc01.txt ========> Not renamed, because its not all numbers.


Im not have the Excel, but Im thinking it should also be able to conduct leading zeros the same way?
So then after pasting your filenames, making a rename-pairs file that does look something like...
1.txt,2.txt
005.txt,006.txt
0000000009.txt,0000000010.txt
Luuk
 
Posts: 691
Joined: Fri Feb 21, 2020 10:58 pm

Re: Incrementally increase numbers

Postby Admin » Thu Nov 11, 2021 8:49 am

Im not have the Excel, but Im thinking it should also be able to conduct leading zeros the same way?


Yes, definitely, it has all sorts of functions to modify text, numbers, etc
Could also use a free spreadsheet software like OpenOffice.
Admin
Site Admin
 
Posts: 2343
Joined: Tue Mar 08, 2005 8:39 pm


Return to Regular Expressions