2

I have some 50 songs which starts with a number, like this:

enter image description here

It is hard to rename each file manually to remove the number prefix part. Example, 06- part from the file name. Is there any other way to remove these numbers?

I tried using CLI:

for %a in (*.*) do @set "fname=%a" & call ren "%fname%" "/s/^\d\s-/"

I know it doesn't work.

0

1 Answer 1

1

Remove number prefix from lot of files

The below batch script should do the trick for you. Just set your sourcedir to the applicable folder where the MP3 file exist, save the logic to a text document but rename it to give it a file extension of .cmd, and then double click on it to run and rename the files accordingly.

@ECHO ON

SETLOCAL ENABLEDELAYEDEXPANSION
SET SourceDir=C:\Users\User\Desktop\songs

FOR /F "TOKENS=2 DELIMS=-" %%F IN ('DIR /B /A-D "%SourceDir%\*.mp3"') DO (  
    REN "%SourceDir%\*%%~F" "%%~F"
)
FOR /F "TOKENS=*" %%F IN ('DIR /B /A-D "%SourceDir%\*.mp3"') DO (
    REN "%SourceDir%\*%%~F" "%%~F"
)
GOTO EOF

Further Resources

0

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .