Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: Maildir empty?
- X-seq: zsh-users 7681
- From: Oliver Kiddle <okiddle@xxxxxxxxxxx>
- To: wacker@xxxxxxxxxxxxxxxxxxxxxx
- Subject: Re: Maildir empty?
- Date: Mon, 12 Jul 2004 11:44:25 +0200
- Cc: ZSH User List <zsh-users@xxxxxxxxxx>
- In-reply-to: <20040712073705.GN2860@xxxxxxxxxxxxxxxxxxxxxxxxxxx>
- Mailing-list: contact zsh-users-help@xxxxxxxxxx; run by ezmlm
- References: <20040712073705.GN2860@xxxxxxxxxxxxxxxxxxxxxxxxxxx>
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
Messages sorted by:
Reverse Date,
Date,
Thread,
Author