Cory Petkovsek wrote:

> In dos I could type in "ren *.php3 *.php" and rename all the extentions of a glob of 
>files.  In linux, "mv *.php3 *.php" does not work the same.  Anyway to do this?
> 
> I thought about
> for i in *.php3 ; do mv $i ... But I don't know how to delete a character from $i.  
>I can append with $i.php and the like, but that would give me 'index.php3.php'..

The sh way would be:

        for i in *.php3
        do
                mv $i "`basename \"$i\" 3`"
        done

basename is a handy gadget -- read the man page.  See also dirname.

Also, there is a program in the Perl source distribution, eg/rename,
which is a more clever rename script.  Using that script, you could
write:

        rename 's/3$//' *.php3

I don't use rename; it feels too much like juggling chainsaws.

-- 
Bob Miller                              K<bob>
kbobsoft consulting
http://kbobsoft.com                     [EMAIL PROTECTED]

Reply via email to