Wow!

So complex!

How about

"rename a a_ *"


-JMS
[EMAIL PROTECTED]


-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED]] On Behalf Of Alexander Skwar
Sent: Saturday, January 26, 2002 2:06 PM
To: [EMAIL PROTECTED]
Subject: Re: [expert] renaming large number of files.


So sprach >Ricardo Castanho de O. Freitas< am 2002-01-26 um 13:11:50
-0200 :
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1

That's not needed, IMO.

> 
> How can I rename large number of files?
> 
> They follow a standard and and numbered sequencially.
> 
> The idea is to give a meaningful name to them.

mmv can do that.  However, I more often end up hacking together a small
regexp, which I then use kinda like this:

files:
a001.png
a231.png
ija231.bmp

Now I'd want to put a _ between the letters and the numbers and also
want to rename them all to .gif

for f in * ; do
        new_name=$(echo $f | perl -p -e 's|(\w+?)(\d+)\..*|$1_$2.gif|')
        # Or maybe:
        # new_name=$(echo $f | perl -p -e
's|([:alpha:]+)(\d+)\..*|$1_$2.gif|')
        echo $new_name
done

regexp's are cool ;)


Want to buy your Pack or Services from MandrakeSoft? 
Go to http://www.mandrakestore.com

Reply via email to