Read and Unread message in maildir (dovecot)


  • Wed 08 March 2023
  • misc

It's often convenient to do a quick check (generally on someone else's mailbox) to see if they just deleted all their mail or whatever. From a shell prompt, here's how to find a count of read and unread messages in a Maildir "cur" directory:

Read:

ls | egrep 'S[^,]*$' | wc -l

Unread:

ls | egrep -v 'S[^,]*$' | wc -l