fix-atime is a great little utility written by Thomas Roessler that fixes up the access times on mbox files.

Mutt compares the mtime and the atime on an mbox file to determine if there is unread mail inside. When looking at a list of mailboxes, it marks ones with unread mail with an N. It also uses the atime method to automatically select the next mailbox with unread mail when 'c'hanging mailboxes.

Unfortunately, if you access an mbox outside of mutt, for example by grepping through your mail, or rsyncing it to another host, the atime is set forward and you lose the unread flag. You can fix atimes by running this program with one or more mbox files as arguments.

Local copy of fix-atime.c.gz (972 bytes)

A patch to fix a bug where the atime is not fixed if only the last message is unread. (403 bytes)

Another patch that fixes some minor nits in the source.
(875 bytes)