On Fri, Dec 25, 2009 at 11:56:44AM +0000, Christian Ebert wrote:
> * Christian Ebert on Friday, December 25, 2009 at 11:45:34 +0000
> > * Wu, Yue on Friday, December 25, 2009 at 13:50:41 +0800
> >> Now I've changed to mbox from maildir, when with maildir, I use a sh 
> >> script to
> >> count the number of mails in directory new/ of each of my mails/ 
> >> sub-directory,
> >> but now I don't know how to achieve it with mbox, any hint will be 
> >> appreciated.
> > 
> > egrep '^From [-a-za-z0-9....@[a-za-z0-9]+\.[a-za-z0-9]+ [A-Z][a-z]{2} 
> > [A-Z][a-z]{2} [ 1-3][0-9] [0-2][0-9]:[0-5][0-9]:[0-5][0-9] [0-9]{4}$' mbox 
> > | wc -l
> 
> oops, should be:
> 
> egrep '^From [-a-za-z0-9....@[-a-za-z0-9]+\.[a-za-z0-9]+ [A-Z][a-z]{2} 
> [A-Z][a-z]{2} [ 1-3][0-9] [0-2][0-9]:[0-5][0-9]:[0-5][0-9] [0-9]{4}$' mbox | 
> wc -l
> 
> But you might be fine with:
> 
> grep '^From ' mbox | wc -l

Thanks, but that's the one part that I want to solve... I'm not familiar with sh
script, the script I use for maildir is the follows:

mailhier=~/.mutt/mails

if [ $(find $mailhier -type f -print | wc -l) -ne 0 ]; then
    for d in "$mailhier/"*
    do
        if [ $(find "$d" -type f -print | wc -l) -eq 0 ]; then
            rm -r "$d"
        fi
    done
fi

I don't know how to do the same thing in sh script for mbox? Any one can figure
me out of it?

Thank you.

-- 
Hi,
Wu, Yue

Reply via email to