help with renumbering/padding

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

help with renumbering/padding

Postby EdgarPS » Thu Mar 23, 2017 3:51 pm

Please indulge a novice! I have a folder of files numbered 1.jpg...10.jpg....100.jpg....etc but my movie-making tool requires them to be 001.jpg...010.jpg...100.jpg.
I see how to pad or prefix 0's but not how to prevent 0's being added to the 100.jpg example. I can get 0.jpg to become 000.jpg but then 100.jpg becomes 00100.jpg which is not helpful. Can somebody please help? Many thanks.
EdgarPS
 
Posts: 2
Joined: Thu Mar 23, 2017 2:45 pm

Re: help with renumbering/padding

Postby therube » Thu Mar 23, 2017 4:27 pm

Does BRU have "natural sort"?
1,2,3,...9,10,11
rather then,
1,10,11,2,3,...9


Must your files maintain their names, only be padded with 0's?
I'm thinking, yes, they must.


So that means that 10:Numbering will not work for you.

(Even if you used 10:Numbering in "chunks"; 1-9, then 10-99, the file names would still need to be consecutive - in other words, there cannot be an missing numbers in the series cause that would change the corresponding file name such that it would no longer match up with the correct "movie". If you had; 10, 11, 13, a rename would make them; 010, 011, 012, to 13 becomes 012, which would not be wanted.)


Can you do it with 1:RegEx?
Not sure, at least I wouldn't know how to go about it?
(Pretty sure there are batch file methods to pad file names & maybe you could start with that & figure a RegEx to do it?)
This is beyond me, https://www.google.com/search?q=regex+pad+a+number+with+0&ie=utf-8&oe=utf-8&aq=t&rls=org.mozilla:en-US:unofficial


JavaScript rename would do it, but I don't know JS.
Similar in BASIC:
Code: Select all
ENTER X$,LENGTH                             
IF LEN(X$)<LENGTH THEN DIM ZERO$(LENGTH,"0")
LET X$=ZERO$(1,LENGTH-LEN(X$))+X$
therube
 
Posts: 392
Joined: Mon Jan 18, 2016 6:23 pm

Re: help with renumbering/padding

Postby KenP » Thu Mar 23, 2017 5:38 pm

I replied in your other thread before seeing this one.

The link in therube's post offers a nice simple solution that's cleaner than the solution I posted in the other thread.

1.
RegEx (1)
Match: (.*)
Replace: 0000\1

2.
Rename
Reset

3.
RegEx (1)
Match: (\d{3})$
Replace: \1
Last edited by KenP on Thu Mar 23, 2017 6:19 pm, edited 1 time in total.
KenP
 
Posts: 198
Joined: Sat Jul 30, 2016 11:25 am

Re: help with renumbering/padding

Postby therube » Thu Mar 23, 2017 6:14 pm

Typo in #3:

Code: Select all
Match: (\d{3}$


should be

Code: Select all
Match: (\d{3}$)


Nice :-).
therube
 
Posts: 392
Joined: Mon Jan 18, 2016 6:23 pm

Re: help with renumbering/padding

Postby KenP » Thu Mar 23, 2017 6:25 pm

I meant it to be "Match: (\d{3})$" but it will work with the parenthesis in either position, it just won't work without it :oops: :wink:

I've edited the post to correct it now.

Thanks :D
KenP
 
Posts: 198
Joined: Sat Jul 30, 2016 11:25 am


Return to BRU Support