Tom's Guide | Tom's Hardware | Tom's Games
![]() |
![]() |
![]() |
i'm newbie of dos mode.
i want this result
235-abcd.mp3 -> abcd.mp3
059-wxyz.mp3 -> wxyz.mp3[3 digit][-][name].mp3 -> [name].mp3
i have a lot of files like this...
How i do???thank a lot

I don't know how to do it with dos command prompt..it would be difficult if not impossible. For DOS it would be better to use some kind of real programming language. But since you are using Windows XP and CMD.exe (which is verry much different than real DOS) it might be doable in batch. But you would need to ask that on a Windows XP part of the forum. Or perhaps at Programming part.

Like DosX indicates, could be an uphill battle in DOS.
You need to state the EXACT version. And, are they all strictly the same naming convention?
=====================================
If at first you don't succeed, you're about average.M2

Win XP Home - Command Prompt.
I think the code below should do it. To rename files remove echo from the ren line when you have ensured that your outcome will be good. You will have to amend the in_file variable to the path of your files. Code has not been tested where there are space(s) in the path\filename.
Good luck.
:: Code start...............
@echo off
setlocalset in_file=d:\temp\
for /f "tokens=*" %%a in ('dir /b %in_file%*.mp3') do call :rename %%a
goto :EOF:rename
set oldname=%1
set newname=%oldname:~4%
echo ren %in_file%%oldname% %newname%echo Old file name = %oldname%
echo New file name = %newname%
:: Code finish................

You simply want to crop the 1st 4 chars of the existing filenames; try this:
@echo off
for %%i in (*.mp3) do (set fName=%%i) & call :rename
goto :eof
:rename
:: Crops the 1st 4 characters of fName):
ren %fName% %fName:~4%
goto :eof
Tommy

You can't call a subroutine in DOS.
Anyway, The OP seems to have lost interest.
12 AUG LOL
=====================================
If at first you don't succeed, you're about average.M2

![]() |
![]() |
![]() |

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.
| Ads by Google |