Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: Maildir empty?
- X-seq: zsh-users 7684
- From: Klaus Wacker <wacker@xxxxxxxxxxxxxxxxxxxxxx>
- To: ZSH User List <zsh-users@xxxxxxxxxx>
- Subject: Re: Maildir empty?
- Date: Mon, 12 Jul 2004 14:41:44 +0200
- In-reply-to: <690.1089625465@xxxxxxxxxxxxxxxxxxxxx>
- Mailing-list: contact zsh-users-help@xxxxxxxxxx; run by ezmlm
- References: <20040712073705.GN2860@xxxxxxxxxxxxxxxxxxxxxxxxxxx> <690.1089625465@xxxxxxxxxxxxxxxxxxxxx>
- Reply-to: wacker@xxxxxxxxxxxxxxxxxxxxxx
On Mon, Jul 12, 2004 at 11:44:25AM +0200, Oliver Kiddle wrote:
> 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.
>
Thank you, that works.
> Are you sure you didn't mean $i/**/*
> You need to use **/ to search a whole directory tree.
>
For the general case I would probably need something like
`$i/**/*(.)'. However, for maildirs, `$i/*/*' is what I need. Each
maildir contains exactly three subdirectories named tmp, new and cur,
and they contain the mail files, one per message.
--
Klaus Wacker wacker@xxxxxxxxxxxxxxxxxxxxxx
Experimentelle Physik V http://www.physik.uni-dortmund.de/~wacker
Universitaet Dortmund Tel.: +49 231 755 3587
D-44221 Dortmund Fax: +49 231 755 4547
Messages sorted by:
Reverse Date,
Date,
Thread,
Author