I've been racking my brains on this one. It should be easy but I think I'm missing something obvious.
I have a group of files (ex. .mp3's) and I would like to add an alphanumeric prefix to the whole group of files in a folder.
Example:
1234567890.mp3
2345678901.mp3
3456789012.mp3
etc.
I would like to prefix all of them with two or three digit characters so the result would be:
Example:
psr1234567890.mp3
psr2345678901.mp3
psr3456789012.mp3
etc.
A simple rename command will strip the filename down to eight characters with my prefix.
Is there a dos script routine I can use to accomplish this?
Thanks - Rick
Append a common text to a group of files
Moderator: DosItHelp
Re: Append a common text to a group of files
Rick, you could use a FOR loop.
Have a look at this small code
This should work if you would place the batch file into the same folder of your .mp3's.
Regards
aGerman
Have a look at this small code
Code: Select all
@echo off &setlocal
set /p "pre=Enter your prefix: "
for /f "delims=" %%a in ('dir /a-d /b *.mp3') do ren "%%a" "%pre%%%a"
This should work if you would place the batch file into the same folder of your .mp3's.
Regards
aGerman
Re: Append a common text to a group of files
Hey! It works! Thanks!
I had to change the second line though.
set pre="rtt"
With rtt being the pre text.
I don't know if it had something to do with XP Pro as the OS.
Anyway, it works and I thank you for the help.
Rick
I had to change the second line though.
set pre="rtt"
With rtt being the pre text.
I don't know if it had something to do with XP Pro as the OS.
Anyway, it works and I thank you for the help.
Rick