Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: Renaming multiple files



On Sat, Jan 15, 2000 at 10:52:48AM -0600, Andrei Zmievski wrote:

> How can I rename all files with one extension to another? For example,
> all *.phtml files to *.php.

My (fairly dumb) solution:

for i in *.phtml; do mv $i $(basename $i .phtml).php; done

It does have the advantage of being fairly easy to remember and it'll work
on any shell.  (Well, if you change $(...) to `...`, anyway.)

I'm sure somebody here can come up with an answer that'll win some
obsfucated "How to rename all files with one extension to another" zsh
content :).


-- 
: Andre Pang <andrep@xxxxxxxxxxx> - Purruna Pty Ltd - ph# 0411.882299 :
:               #ozone - http://www.vjolnir.org/ozone/                :



Messages sorted by: Reverse Date, Date, Thread, Author