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

Re: Maildir empty?



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