I’m using mutt to read my mail through IMAP4_SSL… But currently it lacks of a cache system, so dealing with big folders (~2000) is quite hard for it.

That’s why I hacked an archive utility script to better fit with my needs. The original one is here. The purpose is to move old mails on subtrees of the folder we want to archive, sorted by month.

I mainly added an option relating mail dates comparisons. So now there are two possibilities :

  • believe IMAP dates (appearing as timestamps in beginning of mail filenames) (default behavior)
  • believe Date: Mail header (-m option)

Use-case :)

$ ./mdirarchive.py -m respyre
$ tree ~/Maildir/.respyre* -L 1
/home/phil/Maildir/.respyre
|-- courierimapacl
|-- courierimapkeywords
|-- courierimapuiddb
|-- cur
|-- new
`-- tmp
/home/phil/Maildir/.respyre.2003-06
|-- cur
|-- new
`-- tmp
/home/phil/Maildir/.respyre.2003-09
|-- cur
|-- new
`-- tmp
/home/phil/Maildir/.respyre.2003-10
|-- cur
|-- new
`-- tmp

There is now a subfolder per month. Check script online help for more options.

Download