From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 7514 invoked from network); 19 Oct 2005 01:00:23 -0000 Received: from news.dotsrc.org (HELO a.mx.sunsite.dk) (130.225.247.88) by ns1.primenet.com.au with SMTP; 19 Oct 2005 01:00:23 -0000 Received: (qmail 39383 invoked from network); 19 Oct 2005 01:00:14 -0000 Received: from sunsite.dk (130.225.247.90) by a.mx.sunsite.dk with SMTP; 19 Oct 2005 01:00:14 -0000 Received: (qmail 28317 invoked by alias); 19 Oct 2005 01:00:06 -0000 Mailing-List: contact zsh-users-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 9518 Received: (qmail 28307 invoked from network); 19 Oct 2005 01:00:06 -0000 Received: from news.dotsrc.org (HELO a.mx.sunsite.dk) (130.225.247.88) by sunsite.dk with SMTP; 19 Oct 2005 01:00:06 -0000 Received: (qmail 38189 invoked from network); 19 Oct 2005 01:00:06 -0000 Received: from tantale.fifi.org (64.81.251.130) by a.mx.sunsite.dk with SMTP; 19 Oct 2005 01:00:04 -0000 Received: from ceramic.fifi.org (Debian-exim@ceramic.fifi.org [64.81.251.131]) by tantale.fifi.org (8.9.3p2/8.9.3/Debian 8.9.3-21) with ESMTP id SAA30165; Tue, 18 Oct 2005 18:00:00 -0700 Received: from phil by ceramic.fifi.org with local (Exim 4.34) id 1ES2JE-0000s6-Lt; Tue, 18 Oct 2005 18:00:00 -0700 To: Dan Bullok Cc: Zsh Users Subject: Re: Trouble with zmv and extended globs References: <200510181927.25831.dan.zsh@bullok.com> Mail-Copies-To: nobody From: Philippe Troin Date: 18 Oct 2005 18:00:00 -0700 In-Reply-To: <200510181927.25831.dan.zsh@bullok.com> Message-ID: <873bmywcbz.fsf@ceramic.fifi.org> User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.2 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Spam-Checker-Version: SpamAssassin 3.0.4 (2005-06-05) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-2.5 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=3.0.4 Dan Bullok writes: > I'm having some trouble with zmv. > Suppose I have a bunch of python scripts in a directory, and none of them end > in .py. I want to give them all a proper extension, so I try: > zmv -n '(*)(#qe,file ${REPLY}|grep "python script",)' '$1.py' > This works as I expected it to. > However, if I have a bunch of python scripts in several subdirectories of > varying depths, I try: > zmv -n '(**/con*)(#qe,file ${REPLY}|grep "python script",)' '$1.py' > which gives me the following error: > zmv:238: bad pattern: (*/*)(#qe,file ${REPLY}|grep python,) > > I've also tried: > zmv -n '(*/*(#qe,file ${REPLY}|grep python,))' '$1.py' > which doesn't work either. > > I'm sure I'm missing something, because it seems like it should be possible. > Can someone help me with this, please? I've been trying various permutations > for over an hour, and I'm REALLY stuck. There's an obscure rule in matching that basically says that you cannot combine the ** and *** glob operators with other glob operators within the same path segment. Meaning that ** must be separated from other glob operators. zmv -n '(**)/(con*)(#qe,file ${REPLY}|grep "python script",)' '$1/$2.py' works. However it will not glob files in the current directory. Then you want this: zmv -n '(*/)#(con*)(#qe,file ${REPLY}|grep "python script",)' '$1$2.py' ** is an shortcut for (*/)# Phil.