procmail
[Top] [All Lists]

Re: Scanning IMAP mail (first solution)

2009-11-18 23:32:28

Made a slight change since I noticed that messages in .../new/ do not fit the 
same pattern, at least not in my maildirs.

BIGLIST=`ls -1dA $HOME/Maildir/.*[0-9]-*/{cur,new}/*{net,','} 2>/dev/null | awk 
-F/ '{print $5}'`;
LIST=`echo "$BIGLIST"|uniq`

TOTALC=0
for i in $LIST; do
  COUNT=`echo "$BIGLIST"| grep $i |wc -l`
  echo "$COUNT in $i"
  TOTALC=$(( $TOTALC + $COUNT ))
done

echo "$TOTALC unread"

the 'net' is because my .../new/* messages end in .net, so this catches those 
and the ones in .../cur/ that end in ','

Normally this is not an issue as I have at least one MUA online pretty much all 
the time, but this morning I didn't and the unread counts never changed.


-- 
A man, in a word, who should never have been taught to write and
        whom if unhappily gifted with that ability, should have been
        restrained by a Act of Parliament from writing Reminiscences. 
        - PG Wodehouse


____________________________________________________________
procmail mailing list   Procmail homepage: http://www.procmail.org/
procmail(_at_)lists(_dot_)RWTH-Aachen(_dot_)de
http://mailman.rwth-aachen.de/mailman/listinfo/procmail