Numbering reset after X numbers

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

Numbering reset after X numbers

Postby XionicFire » Thu Feb 17, 2022 4:32 am

Hi, simple question

How do Reset numbering after X files, say add 1,2,3 then 1,2,3 again and so on

So files look like:
1-2021-02-16-20-23-48
2-2021-02-16-20-23-49
3-2021-02-16-20-23-50
1-2021-02-16-20-23-51
2-2021-02-16-20-23-52
3-2021-02-16-20-23-53
1-2021-02-16-20-23-54
2-2021-02-16-20-23-55
3-2021-02-16-20-23-56
and so on

Ive tried all the options and none seem to do this, maybe im missing something? ive also searched the web and this board and nothing.
Any help is greatly apreciated.
XionicFire
 
Posts: 4
Joined: Thu Feb 17, 2022 4:25 am

Re: Numbering reset after X numbers

Postby XionicFire » Thu Feb 17, 2022 4:39 am

atm if i have to reset the numbers every 2 or 4 numbers ive used increasing by 4 or 5 then replacing and removing

Basically say you wanted to reset the number every 2 files, so ud go increase by 5, then the numbers would go 5,10,15,20,25 and so on, if you remove all but the last digit, you end up with 0,5,0,5,0,5,0,5,0 you can then replace the 5 for a 1 and get 0,1,0,1,0,1,0 but its a pain to have to do this in several passes and ive only figured how todo it for 2, 4 and 5 file repeat, if anyone has any idea of how to properly do this would be awesome
XionicFire
 
Posts: 4
Joined: Thu Feb 17, 2022 4:25 am

Re: Numbering reset after X numbers

Postby Luuk » Thu Feb 17, 2022 6:42 am

To prefix 01-, 02-, 03-, and then continue restarting the prefix like 01-, 02-, 03-, ...
Numbering(10) could use Mode==Prefix, Start==1, Pad=2, Break=1, Sep.==-, Type==Base4

The secret is making your "Pad" 1-higher than "Break", and then "Base" is 1-higher than your maximum.
Its unfortunate, but you need at least Break==1, so this does also mean that your "Pad" must be at least 2.
But you can always remove the padding later if its not to be desired, or javascript could rename without the padding.
Luuk
 
Posts: 690
Joined: Fri Feb 21, 2020 10:58 pm

Re: Numbering reset after X numbers

Postby XionicFire » Thu Feb 17, 2022 6:54 am

Interesting, ill give it a shot with your solution, yeah it sucks to have to remove the padding but i guess its better than no solution
XionicFire
 
Posts: 4
Joined: Thu Feb 17, 2022 4:25 am

Remove leading-zeroes

Postby Luuk » Thu Feb 17, 2022 8:06 am

To remove the padding from files starting like 0Digits-Text, the RegEx(1) can use a "Match" and "Replace" like...
^0*(\d+-.*)
\1
Luuk
 
Posts: 690
Joined: Fri Feb 21, 2020 10:58 pm

Re: Numbering reset after X numbers

Postby XionicFire » Sun Feb 20, 2022 8:28 pm

yep, atm to remove the padding i just run it again, but the regex option seems like a good script idea.

Thanks everyone for the solutions, definitely solved the problem
XionicFire
 
Posts: 4
Joined: Thu Feb 17, 2022 4:25 am


Return to BRU Support