Tuesday, March 18

Mail and it's conversion

I recently had to move a ton of email (several hundreds of thousands) from one server to another.  (Damn you Gmail IMAP).  On one server all my email was in Maildir and in order to move all that email to the server I wanted it on, I had to import it into Mail.app.  Mail.app imports from a number of formats, the one I was interested in was mbox.  So, I scp'ed all my email down from server #1, of course, in Maildir.  So I needed some conversion from Maildir to mbox.  I found this script online with a quick Google search:

#!/bin/bash
echo search mdir-files in $1 and send them to mbox: $2
for file in `find $1 -type f`
do
echo parsing: $file
cat $file | formail >> $2
done

It took a long time to do, but now all my email is comfortably resting on server #2.  

No comments: