Add zero inside files with single or double digits

A swapping-ground for Regular Expression syntax

Add zero inside files with single or double digits

Postby mart1n » Mon Dec 30, 2013 9:00 pm

I have a number of files numbered by windows with the usual brackets, but when I open BRU they are visualized this way:

Er (1)
Er (10)
Er (100)
Er (101)
Er (102)
Er (103)
Er (104)
Er (105)
Er (106)
Er (107)
Er (108)
Er (109)
Er (11)
Er (110)
etc...

There's a way to add zero only to the ones with single digit or double digit?
So to have EBAL (001), EBAL (002), EBAL (003), etc...
Equalize the number of characters of the files by adding zeros to the ones that don't have one.
mart1n
 
Posts: 3
Joined: Mon Dec 30, 2013 8:08 pm

Re: Add zero inside files with single or double digits

Postby Stefan » Mon Dec 30, 2013 10:42 pm

mart1n wrote:I have a number of files numbered by windows with the usual brackets, but when I open BRU they are visualized this way:

Er (1)
Er (10)
Er (100)
Er (101)
Er (102)
Er (103)
Er (104)
Er (105)
Er (106)
Er (107)
Er (108)
Er (109)
Er (11)
Er (110)
etc...


For the correct view try menu "Options > Sorting > Logical Sorting". Then refresh the view.


.

- - -

.


There's a way to add zero only to the ones with single digit or double digit?
So to have EBAL (001), EBAL (002), EBAL (003), etc...
Equalize the number of characters of the files by adding zeros to the ones that don't have one.



Do this regex renaming two times:

FROM:
abc (1).ext
TO:
abc (001).ext
DO:
RegEx(1)
Match: "(.+) \((\d)\)"
Repla: "\1 (00\2)"


Rename, go to step two:



FROM:
abc (10).ext
TO:
abc (010).ext
DO:
RegEx(1)
Match: "(.+) \((\d\d)\)"
Repla: "\1 (0\2)"

Rename. Done.


.

.

Some notes:
"[__] Include Ext." is unchecked.
Don't use the quotes "", they are only there for clarifying where the pattern begins and ends.


INSTRUCTIONS (how to use and which option to set):
= This solution is provide by my tests or assumption based on my experiences in the past.
I can give no guarantee that your computer will not explode and delete all your files.
The solution is based on the provided information and may not work for other file name pattern.
= Remember to test this with some test files first. And always do a backup before you manipulate your important real files!
= Select a few files in the Name column to see what happens in the NewName column.
= Menu "Options > Ignore... > File Extensions" is unchecked.
= My pattern '.ext' stands for any file extension like '.mp3' or '.txt', as that often doesn't matters.
= Sometimes I use the sign '~' instead a real space for better recognizability, like: "Interpret~~-~~Song.mp3" to "Interpret~-~Song.mp3"
= More about RegEx can be found there >>> http://www.bulkrenameutility.co.uk/forum/viewtopic.php?f=3&t=96
(that's: Board index ‹ Bulk Rename Utility ‹ Regular Expressions > "Getting help with Regular Expressions")


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

Re: Add zero inside files with single or double digits

Postby mart1n » Mon Dec 30, 2013 11:16 pm

It worked perfectly, thanks!
mart1n
 
Posts: 3
Joined: Mon Dec 30, 2013 8:08 pm


Return to Regular Expressions