On 26-12-2009, at 18h 12'03", Wu, Yue wrote about "Re: How to count new emails in mbox format mailbox?" > > My script does this: count the mails in some particular maildir, then assign > the > number to a var: > > > if [ -d ${mymaildir} -a $(find ${mymaildir} -type f -print | wc -l) -ne 0 ]; > then > mailsnew="$(find ${mymaildir}/*/new -type f | wc -l | sed 's/ //g')" > # mails=$(($(find ${mymaildir}/*/cur -type f | wc -l | sed 's/ //g') + > ${mailsnew})) > if [ ${mailsnew} -ne 0 ]; then > if [ -d ${mymaildir}/private ]; then > privmailnew="$(find ${mymaildir}/private/new -type f | wc -l | > sed 's/ //g')/" > fi > if [ -d ${mymaildir}/inbox ]; then > inmailnew="$(find ${mymaildir}/inbox/new -type f | wc -l | sed > 's/ //g')/" > fi > mailsfmt="[${privmailnew}${inmailnew}${mailsnew}]" > fi > fi > > But I don't know how to transform this script to suit for mbox mails counting. >
You were told already... privmailnew=$(grep -c '^From ' ${private}) inmailnew=$(grep -c '^From ' ${inbox}) Replace ${private} and ${inbox} with the files you keep the e-mails. Ionel