Computing.Net > Forums > Disk Operating System > Batch name change with DOS

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Click here to start participating now! Also, check out the New User Guide.

Batch name change with DOS

Reply to Message Icon

Name: BlueHeron
Date: November 1, 2009 at 18:55:55 Pacific
OS: Windows Vista
Product: Microsoft Windows vista home premium w/sp1
Subcategory: General
Comment:

I have a lot of files that I need to change part of their file name and figure it will be easiest to do in DOS. For example, I want to change the file names:

tro344-07-MySong-MyAlbum.mp3 and
tro344-08-YourSong-YourAlbum.mp3

I want to get rid of the tro344-07- and the tro344-08-

so that I am left with:

MySong-MyAlbum.mp3 and
YourSong-YourAlbum.mp3

Can you tell me what DOS command I would need to enter to do this? Thanks for you help!



Sponsored Link
Ads by Google

Response Number 1
Name: Mechanix2Go
Date: November 1, 2009 at 22:48:32 Pacific
Reply:

There is no DOS in vist.

============================
@echo off & setLocal EnableDELAYedExpansion

for /f "tokens=* delims= " %%a in ('dir/b/a-d') do (
for /f "tokens=3-4 delims=-" %%i in ("%%a") do (
echo ren %%a %%i-%%j
)
)


=====================================
Helping others achieve escape felicity

M2


0

Response Number 2
Name: BlueHeron
Date: November 2, 2009 at 07:22:13 Pacific
Reply:

Thanks for your help. I downloaded a free batch rename utility program,,,worked great!

Thanks again!


0

Response Number 3
Name: Sen Hu
Date: November 16, 2009 at 07:00:18 Pacific
Reply:

Here is another script.

# Script tro.txt
cd "/some_directory"
var str list, file, newname
lf -n "tro*.mp3" > $list
while ($list <> "")
do
    lex "1" $list > $file ; stex -p "^-^2[" $file > $newname
    system rename $file $newname
done

Save the script in file C:/Scripts/tro.txt, start biterscripting ( http://www.biterscripting.com ), enter the following command

script tro.txt

Make sure you change "/some_directory" to the full path of the directory where files are located, enclosed in double quotes.

Sen



0
Reply to Message Icon

Related Posts

See More


Batch file with user inpu... On my laptop the sound is...


Use following form to reply to current message:

Login or Register to Reply
LoginRegister


Sponsored links

Ads by Google


Results for: Batch name change with DOS

SOS! Need help with DOS Batch problem www.computing.net/answers/dos/sos-need-help-with-dos-batch-problem/7906.html

change a DSN with DOS commands www.computing.net/answers/dos/change-a-dsn-with-dos-commands/14084.html

trouble with DOS www.computing.net/answers/dos/trouble-with-dos/7638.html