From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 11419 invoked from network); 12 Jul 2004 09:46:42 -0000 Received: from odin.dotsrc.org (HELO a.mx.sunsite.dk) (130.225.247.85) by ns1.primenet.com.au with SMTP; 12 Jul 2004 09:46:42 -0000 Received: (qmail 31797 invoked from network); 12 Jul 2004 09:49:40 -0000 Received: from sunsite.dk (130.225.247.90) by a.mx.sunsite.dk with SMTP; 12 Jul 2004 09:49:40 -0000 Received: (qmail 11380 invoked by alias); 12 Jul 2004 09:45:55 -0000 Mailing-List: contact zsh-users-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 7681 Received: (qmail 11369 invoked from network); 12 Jul 2004 09:45:55 -0000 Received: from odin.dotsrc.org (HELO a.mx.sunsite.dk) (qmailr@130.225.247.85) by sunsite.dk with SMTP; 12 Jul 2004 09:45:55 -0000 Received: (qmail 30686 invoked from network); 12 Jul 2004 09:49:08 -0000 Received: from mail36.messagelabs.com (193.109.254.211) by a.mx.sunsite.dk with SMTP; 12 Jul 2004 09:48:53 -0000 X-VirusChecked: Checked X-Env-Sender: okiddle@yahoo.co.uk X-Msg-Ref: server-10.tower-36.messagelabs.com!1089625512!7632017 X-StarScan-Version: 5.2.10; banners=-,-,- X-Originating-IP: [158.234.9.163] Received: (qmail 8018 invoked from network); 12 Jul 2004 09:45:12 -0000 Received: from iris.logica.co.uk (158.234.9.163) by server-10.tower-36.messagelabs.com with SMTP; 12 Jul 2004 09:45:12 -0000 Received: from trentino.logica.co.uk ([158.234.142.61]) by iris.logica.co.uk (8.12.3/8.12.3/Debian -4) with ESMTP id i6C9jAUI008036; Mon, 12 Jul 2004 10:45:10 +0100 Received: from trentino.logica.co.uk (localhost [127.0.0.1]) by trentino.logica.co.uk (Postfix) with ESMTP id DA43878FA500; Mon, 12 Jul 2004 11:44:25 +0200 (CEST) Cc: ZSH User List X-VirusChecked: Checked X-StarScan-Version: 5.0.7; banners=.,-,- In-reply-to: <20040712073705.GN2860@born.physik.uni-dortmund.de> From: Oliver Kiddle References: <20040712073705.GN2860@born.physik.uni-dortmund.de> To: wacker@Physik.Uni-Dortmund.DE Subject: Re: Maildir empty? Date: Mon, 12 Jul 2004 11:44:25 +0200 Message-ID: <690.1089625465@trentino.logica.co.uk> X-Spam-Checker-Version: SpamAssassin 2.63 on a.mx.sunsite.dk X-Spam-Level: X-Spam-Status: No, hits=0.0 required=6.0 tests=BAYES_50 autolearn=no version=2.63 X-Spam-Hits: 0.0 Klaus Wacker wrote: > Dear zsh, is there a zsh-internal way to find out whether a maildir is > empty? Or more generally, whether a directory tree contains no > files? The following test ($i is the pathname of the maildir): > > if [[ $(echo $i/*/* | wc -w) -eq 0 ]] Does this do what you want: if [ -z $i/*/*([1]) ] You need to use the single brackets so that the $i/*/* is treated as a filename expansion. The ([1]) part makes sure that only one file is expanded. Are you sure you didn't mean $i/**/* You need to use **/ to search a whole directory tree. Oliver