Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Computing > NZ Computing > Help requested: renaming in batch file

Reply
Thread Tools

Help requested: renaming in batch file

 
 
Pleb Plebian
Guest
Posts: n/a
 
      01-31-2006
I'm attempting to rename a bunch of mp3's (as my portable player won't play
them in order properly)
From
1-name.mp3
to
01-name.mp3

Obviously, I'm only looking to do this for tracks 1-9

My problem is that

ren ?-* 0?-*.mp3
gives me a "file in use" error.

Ok: workaround, run it individually for ?=1 to 9
(ie)
ren 1-* 01-*.mp3
ren 2-* 02-*.mp3
(etc)

This however overwrites the first letters of the name (and drops the suffix
if the .mp3 isn't appended)
ie from 1-name.mp3 to 01-ame.mp3

I'm obviously doing something simple (I hope wrong: can anyone assist in
making this work properly?

OS's: Win98 and XP

Oh: if possible, any thoughts on how I can get this to run in subfolders of
the parent "music" folder?
Any and all pointers _very_ welcomed!
Thanks
-P


 
Reply With Quote
 
 
 
 
The Other Guy
Guest
Posts: n/a
 
      01-31-2006
Pleb Plebian wrote:
> I'm attempting to rename a bunch of mp3's (as my portable player won't play
> them in order properly)
> From
> 1-name.mp3
> to
> 01-name.mp3
>
> Obviously, I'm only looking to do this for tracks 1-9
>
> My problem is that
>
> ren ?-* 0?-*.mp3
> gives me a "file in use" error.
>
> Ok: workaround, run it individually for ?=1 to 9
> (ie)
> ren 1-* 01-*.mp3
> ren 2-* 02-*.mp3
> (etc)
>
> This however overwrites the first letters of the name (and drops the suffix
> if the .mp3 isn't appended)
> ie from 1-name.mp3 to 01-ame.mp3
>
> I'm obviously doing something simple (I hope wrong: can anyone assist in
> making this work properly?
>
> OS's: Win98 and XP
>
> Oh: if possible, any thoughts on how I can get this to run in subfolders of
> the parent "music" folder?
> Any and all pointers _very_ welcomed!


I'm running FreeBSD at the moment so I can't throw together a script to
test this, but the way I'd look to do it would be using 'for', using '-'
as the delimiter, then simply checking appending '0' to the front if the
value is less than 10.

Something like...

for /f "delims=- tokens=1,* " %%a in ('dir /b *.mp3') do (
if "%%a" lss 10 (set pad=0) else set pad=
ren %%a-%%b %pad%%%a
)

Of course this is full of errors, but it might give you an idea of where
to start.

Sub-folders should also be possible, but I'd tend to do this by calling
a script for each directory, found using 'dir /b /s /a:d'.

The Other Guy
 
Reply With Quote
 
 
 
 
The Other Guy
Guest
Posts: n/a
 
      01-31-2006
The Other Guy wrote:
> Something like...
>
> for /f "delims=- tokens=1,* " %%a in ('dir /b *.mp3') do (
> if "%%a" lss 10 (set pad=0) else set pad=
> ren %%a-%%b %pad%%%a
> )


You would need to use !pad! and enabled delayed variable expansion to
get this to work.

The Other Guy
 
Reply With Quote
 
Kiwi
Guest
Posts: n/a
 
      01-31-2006
On Tue, 31 Jan 2006 14:40:21 +1300, "Pleb Plebian"
<> wrote:

>I'm attempting to rename a bunch of mp3's (as my portable player won't play
>them in order properly)
>From
>1-name.mp3
>to
>01-name.mp3
>
>Obviously, I'm only looking to do this for tracks 1-9
>

Do a google search for "1-4a Rename". This is a great program fro
multiple renames under win 98, 2k and XP.

Cheers, Kiwi
 
Reply With Quote
 
pleb.plebian@gmail.com
Guest
Posts: n/a
 
      01-31-2006
Thanks Kiwi!
Not the solution I was heading towards-but very effective and
appreciated: it'll do the trick
Much appreciated also, Other Guy: will have a play with your
suggestions and hopefully learn along the way
Cheers
-P

 
Reply With Quote
 
~misfit~
Guest
Posts: n/a
 
      01-31-2006
Kiwi wrote:
> On Tue, 31 Jan 2006 14:40:21 +1300, "Pleb Plebian"
> <> wrote:
>
>> I'm attempting to rename a bunch of mp3's (as my portable player
>> won't play them in order properly)
>> From
>> 1-name.mp3
>> to
>> 01-name.mp3
>>
>> Obviously, I'm only looking to do this for tracks 1-9
>>

> Do a google search for "1-4a Rename". This is a great program fro
> multiple renames under win 98, 2k and XP.


I went to download this and got asked if I want to over-write. I already
have it, must have read someone else recommend it and downloaded it then.
Haven't needed it yet. However, I have a ~4GB folder full of apps and
utilities I've downloaded over the years and moved from PC to PC.

Actually, thanks for the reminder. Now I have a DVD writer I must write the
folder to disc. I used to with CD-Rs but the folder got too big to fit on
one CD-R a couple years ago. There's some old stuff in there, downloaded
mobo manuals for just about every mobo I ever worked on that I didn't have a
hard-copy manual for, multple drivers, especially modem drivers... The list
goes on.

Cheers,
--
~misfit~


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
[ANN]: 'tren' Cross-Platform Batch Renaming Tool, Version 1.239 Released Tim Daneliuk Python 0 11-18-2010 03:39 AM
[ANN]: 'tren' Cross-Platform Batch Renaming Tool, Version 1.217 Released Tim Daneliuk Python 0 04-26-2010 03:44 PM
Batch File - Renaming File with DATE Tom Computer Support 11 03-05-2007 10:33 PM
Image Batch Renaming Software Advice Please bird_head Digital Photography 5 10-07-2006 08:10 AM
Batch renaming in PSE 3 GrandSchtroumpf Digital Photography 0 01-07-2005 10:53 AM



Advertisments