[Evolution] Script for exporting mail from kmail to evolution



After checking out Evolution in FC3, I finally decided to move to it as
I find it to be quite stable in this version ( I always liked it for its
features. I only had issues with its stability).

Unfortunately, I had about half a GB of mail in Kmail that I had to move
on to Evolution. After googling for a day, I couldn't find a way to do
it easily.

I therefore wrote this tiny script which did the trick for me, and I
hope it helps others to move on to Evolution from Kmail, if they desire.

Before you use this script,
 
!!!!!     BACKUP ~/Mail    !!!!! 

Also exit kmail if it is running.

1. To use this script you need maildir2mbox - either the one which comes
along with qmail, or the one at
http://www.systemsaligned.com/Learning_Centre/OSS_Projects/Maildir_to_mbox_Conversion_Utility/61/
Download the binary packaged in maildir2mbox.tar.gz, untar it and put
somewhere in your path.

2. The script relies on certain assumptions - 
      a) There is no mail folder in kmail named "cur", 
      b) There is no file or directory at "~/mail/exports". 
      c) There is no evolution mail folder named "exports". 
   If any of these assumptions are untrue, modify the script
accordingly.
       
3. Change directory to ~/Mail, and run this script. It will export all
your Kmail maildirs to mboxes under ~/mail/exports

4. Run evolution. Use File->Import->"Import Data and settings from older
programs"-> Pine (Check the checkbox next to Mail)

All your mail will be imported under a new mail folder named exports. 

:)

Script kmail2evo.sh follows (the line beginning with TO= might get
wrapped in your mail reader):
=====================================================================
#!/bin/bash

if [ "x$1" = "x" ]
then
    FROMDIR=`pwd`
else
    FROMDIR=$1
fi

TODIR=$HOME/mail/exports

find $FROMDIR -name cur | (
    while `true`
    do 
        read x
        [ "x$x" = "x" ] && exit $?
        DIR=`dirname "$x"`
        FROM=$DIR
        TO=$TODIR/`echo $DIR | sed -e 's{/\.{/{g' -e
's/\.directory/.d/g' -e "s{$FROMDIR/{{g" `
        [ -e "`dirname \"$TO\"`" ] || mkdir -p "`dirname \"$TO\"`" 
        echo "Maildir \"$FROM\"  => Mbox \"$TO\""
        MAILDIR="$FROM" MAIL="$TO" MAILTMP="$TODIR/tmp.$$" maildir2mbox
    done

    )
=====================================================================

HTH,
 Sandip


--
Sandip Bhattacharya    *    Puroga Technologies   *     sandip puroga com
Work: http://www.puroga.com        *         Home: http://www.sandipb.net

PGP/GPG Signature: 51A4 6C57 4BC6 8C82 6A65 AE78 B1A1 2280 A129 0FF3

What kind of sordid business are you on now?  I mean, man, whither
goest thou?  Whither goest thou, America, in thy shiny car in the night?
                -- Jack Kerouac




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]