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

Re: Renaming multiple files



Thomas K hler wrote:
> On Tue, Jan 18, 2000 at 04:41:10PM +0100,
> Andy Spiegl <zsh.Andy@xxxxxxxxx> wrote:
> > 
> > > for i in *.phtml ; do mv $i ${i:r}.php ; done
> > Nifty.  But do you guys know mmv?
> > It's as easy as this:
> >  mmv '*.phtml' '#1.php'
> 
> And, well, doesn't let zsh globbing work. Bad :-}

I wrote a function zmv that does; it would work like this:
  zmv '(*).phtml' '$1.php'
(positional parameters match parentheses). The bad news is it only works
with the latest development version, not 3.1.6.  However, I'll add it to
Functions/Misc from now on (it was posted to zsh-workers a few of months
ago), and it'll appear in future versions. 

> How do you do
> for i in **/*.php(I) ; do mv $i ${i:r}.phtml ; done
> with mmv?

Actually, further bad news is that you can't do **/... with zmv yet, but
I expect that can be fixed.  I'll have a look sometime.

-- 
Peter Stephenson <pws@xxxxxxxxxxxxxxxxxxxxxxxx>



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