Recently I’ve become aware of how big my Maildir mailboxes are getting. I keep a running record of much of my correspondence and don’t want to delete it but at the same time I don’t want to load every message each time I open a mailbox. Google came up with a couple of archive scripts but they tended to rely on the file date rather than checking the actual Date header from within the mail file. As a solution, I produced this little Python script.
archive.py path/to/maildir [path/to/maildir]…
This defaults to archiving any messages over 365 days old. I’m sure even the non-Python people can see how to change this in the script! Messages are archived to path/to/maildir/archive.