1. how to "batch" rename files?

I wanted to rename a bunch of files in a bunch of directories,
all directories are under one directory,
retaining some "numbers" originally present in the files names,
and then adding numbers which represent the directories the files are in.

eg: directory: CDdisk1
    files:  01 track 01.wma, 02 track 02.wma, etc
rename to:  01 01.wma, 01 02.wma (disk number followed by track number)

Intention was to rip tracks from "books on CD" to put onto MP3 player.
But in order to have the files in player ordered properly sequentially,
I have to rename them from what the ripping yields, 'cause every way I tried
to copy them to player yielded mal-sequencing, until I renamed them as above.

So I wrote a program to do it; everything eventually worked, UNTIL I got to:
SYSTEM command to do the actual RENAMEING, 
which seems to require "hard" text, no VARIABLE allowed.

I hope I'm missing something!!

Can 
system("rename...",2)

be used to reference filenames in variables, or is it limited to what you
type into the quotes?  

If system can't be used as I envisioned, is there another way to
programmatically rename files with varying parts of names???

Dan Moyer

new topic     » topic index » view message » categorize

2. Re: how to "batch" rename files?

I just found Daniel Berstein's "Standard DOS directory and file
maipulation functions" in the archive, which look like they could work.

But I'm too tired to "maipulate" right now :)

Dan

new topic     » goto parent     » topic index » view message » categorize

3. Re: how to "batch" rename files?

Dan Moyer wrote:

<snip>

> Can 
> }}}
<eucode>
> system("rename...",2)
> </eucode>
{{{

> be used to reference filenames in variables, or is it limited to what you
> type into the quotes?  

<snip>

Just use something like the following:
sequence myvar
myvar = "\"the old.txt\" \"the new.txt\""    -- or whatever is required
system("rename " & myvar, 2)


Regards,
   Juergen

new topic     » goto parent     » topic index » view message » categorize

4. Re: how to "batch" rename files?

Juergen Luethje wrote:
> 
> Dan Moyer wrote:
> 
> <snip>
> 
> > Can 
> > }}}
<eucode>
> > system("rename...",2)
> > </eucode>
{{{

> > be used to reference filenames in variables, or is it limited to what you
> > type into the quotes?  
> 
> <snip>
> 
> Just use something like the following:
> }}}
<eucode>
> sequence myvar
> myvar = "\"the old.txt\" \"the new.txt\""    -- or whatever is required
> system("rename " & myvar, 2)
> </eucode>
{{{

> 
> Regards,
>    Juergen


Thanks Juergen,

I suspected I was missing something obvious, sigh.

Dan

new topic     » goto parent     » topic index » view message » categorize

Search



Quick Links

User menu

Not signed in.

Misc Menu