Converting Maildir to mbox via mutt

Ran into an issue today where I needed to convert a Maildir containing over 50k messages to mbox format and couldn’t really find any good tools. So I found this blog post about using mutt to do it. Unfortunately, it converted one Maildir to another. =( One crucial piece is missing, so here is the one-liner in all its glory:

$ mutt -f Archive/ -e 'set mbox_type=mbox; set confirmcreate=no; \
set delete=no; push "T.*<enter>;sarchive<enter><quit>"'

The above converts the Maildir Archive/ to the mbox named archive. It also makes the assumption that mbox_type is set to Maildir (which is how I have it configured; if it wasn’t for that, the default is mbox and that’s what it would have created, but I changed the default to Maildir, hence the need to be specific). Line break was added for clarity.

4 comments for “Converting Maildir to mbox via mutt

  1. Francis
    March 10, 2010 at 4:57 pm

    Thanks, found it really useful!

  2. January 6, 2012 at 4:52 pm

    Yeah, and i found bunch of stupid scripts and here it is ā€” i can convert my maildirs with mutt! Thanks, awesome tip.

  3. mumbi
    February 27, 2013 at 11:23 pm

    Thank you,it worked like a charm!