On 25-12-2009, at 21h 12'52", Wu, Yue wrote about "Re: How to count new emails 
in mbox format mailbox?"
> 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?
> 

Your script does this:

        if [ number of regular files in $mailhier is not zero ] then
           for all folders in $mailhier/ do
               if [ number of regular files in $mailhier/folder is zero ]
                  then delete folder
               fi
           done
        fi

The thinking behind this for mbox format is different because you do
not have so many files...

A simply line will do:

   find $mailhier -empty -exec \rm -f {} \; 

or, if in a script, protect the sensitive characters (\, {, }, etc.):

   find $mailhier -empty -exec \\\rm -f \{\} \\\;

Ionel

Reply via email to