How to remove numbers, characters from beginning file names

Bulk Rename Utility How-To's

How to remove numbers, characters from beginning file names

Postby Flourgrader » Wed Feb 24, 2021 2:53 pm

Hi All,
I have BRU on a Windows 10 PC
Can someone give me some advice in how to rename
37,000 music files I have?
I want to remove the track number at the beginning of each of the songs and any other characters which have been added including empty space.
The length of the string of characters at the begging is not consistent in length.
Which in my mind makes it harder to do?
I have given a few examples below in what I mean.
There are obviously too many songs to do it one by one!
99_madonna vogue.mp3
1. madonna vogue.mp3
1_ madonna vogue.mp3
10- madonna vogue.mp3
--- madonna vogue.mp3
I want it to look like this “madonna_vogue.mp3”
Thank You.
Flourgrader
 
Posts: 2
Joined: Wed Feb 24, 2021 2:00 pm

Re: How to remove numbers, characters from the beginning of a fi

Postby therube » Wed Feb 24, 2021 5:19 pm

I'd start small... take it in steps... A start...

1:RegEx
Code: Select all
Match:  (^[^a-zA-Z]+)(.*)
Replace:  \2

That says to disregard any starting characters that are not alpha characters (& keep the rest).

Do note that that will fail on a song like:
Code: Select all
10 Years After - I'd Love To Change The World.mp3

changing it to:
Code: Select all
Years After - I'd Love To Change The World.mp3
therube
 
Posts: 1314
Joined: Mon Jan 18, 2016 6:23 pm

Re: How to remove numbers, characters from the beginning of a fi

Postby Flourgrader » Wed Feb 24, 2021 8:50 pm

Thanks for the advice,I did appreciate it.
Flourgrader
 
Posts: 2
Joined: Wed Feb 24, 2021 2:00 pm

Re: How to remove numbers, characters from beginning file names

Postby rtoledo2002 » Sat Mar 13, 2021 1:14 am

I hope someone gets a laugh out of my situation as i do.

I found this wonderful program back when it was version 2.7 I quickly figured out how to use it to remove the 2 numbers at the begining of my 130 gigs of music files.

Then later I updated to 3.0 and donated cause I found , that using it just once saved me tons of hours. fast forward to today , I lost the " clean " directory and had to goback to back ups in my Synology NAS. my memory has been going away lately 63 years old( Alhzheimer's runs in my family ) anyway , I came to this forum to figure out what I had figured out a couple of years back and the example in this thread is giving me some weird results with ADDED numbers ? I took a screen capture so you can see what I'm doing and how it should be done correctly.


Image
rtoledo2002
 
Posts: 4
Joined: Sat Mar 13, 2021 12:56 am

Re: How to remove numbers, characters from beginning file names

Postby rtoledo2002 » Sat Mar 13, 2021 1:23 am

rtoledo2002
 
Posts: 4
Joined: Sat Mar 13, 2021 12:56 am

Re: How to remove numbers, characters from beginning file names

Postby rtoledo2002 » Sat Mar 13, 2021 1:29 am

Image
rtoledo2002
 
Posts: 4
Joined: Sat Mar 13, 2021 12:56 am

Re: How to remove numbers, characters from beginning file names

Postby Luuk » Sat Mar 13, 2021 3:14 am

Greetings, Im no ideas what you like for the new names, but ...
RegEx(1) removes all beginning chars that arent a-z or A-Z, because theres no \1 inside the "Replace".
Numbering(10) is then prefixing the numbers.
Luuk
 
Posts: 692
Joined: Fri Feb 21, 2020 10:58 pm

Re: How to remove numbers, characters from beginning file names

Postby rtoledo2002 » Sun Mar 14, 2021 1:17 am

Luuk wrote:Greetings, Im no ideas what you like for the new names, but ...
RegEx(1) removes all beginning chars that arent a-z or A-Z, because theres no \1 inside the "Replace".
Numbering(10) is then prefixing the numbers.


THANK YOU FOR REPLYING on the picture above the first song starts with 01 - Randy Travis . I would like to remove the 01 - . I would prefer to first remove all the 2 digit numbers and then do a second pass and remove the -

Hope this explains it better, hope someone has ideas .

thanks again
rtoledo2002
 
Posts: 4
Joined: Sat Mar 13, 2021 12:56 am

Remove first 2 numbers from beginning

Postby Luuk » Sun Mar 14, 2021 9:38 am

The Regex(1) can do this in first pass, with the "Match" and "Replace" like ...
^\d\d[ -]+(.*)
\1
The ^\d\d[ -]+ is saying "Beginning two numbers, followed by one-or-more "space" or "-".
Then (.*) is saying "(everything else)", so \1 using (.*) as the new name, renaming like...

12 --- filename.txt ===> filename.txt
12-filename.txt =====> filename.txt
12 filename.txt =====> filename.txt
122 - filename.txt ===> (no rename, because three numbers)
123filename ========> (no rename, because three numbers and no "space" or "-")
12filename.txt ======> (no rename, because no "space" or "-" after "beginning two numbers")

=========================================================================

If also wanting to rename the last example?? Im recommend using this instead..
^\d\d[ -]*([^\d].*)
\1
The ^\d\d[ -]* is saying "Beginning two numbers, followed by zero-or-more "space" or "-".
Then ([^\d].*) is saying "(Not a number, everything else), so \1 using this as the new name.

It also renames the last example, so always removing... "First two numbers" (if not a third number) and any following "space" or "-".
If the solutions cannot help for all of the filenames, then need more examples so maybe there can be another regex to better conduct all of the examples.
Also Im thinking its safer with "Renaming Options, Prevent Duplicates" in case you have any exact same filenames, but with different "Beginning two numbers".
Luuk
 
Posts: 692
Joined: Fri Feb 21, 2020 10:58 pm


Return to How-To