I cleaned up the confusing script comments.
Please use this attached version instead.


I converted my mbox to Maildir format using the script 
posted in Comment 1 of the following URL:

http://rg03.wordpress.com/2007/11/22/universal-mailbox-converter-in-24-lines/

It is attached too.

Illustration of steps (be careful):

$ chmod u+x mbox2Maildir.py

$ cd ~/.local/share/evolution/mail/local/

The following individual commands need to be all in 1 line!
Depending on the size, each of these can take quite a long,
so go for a break and don't ^C cancel it.

Convert 1 mbox at a time to new Maildir folder:
$ echo OldSrcEmailFolderInmboxFormat .hiddenFolderNewDstMaildirFormat | 
  { read src dst ; mkdir -p $dst/{cur,new,tmp} ; 
  /path/mbox2Maildir.py ../mbox/$src $dst ; }


Convert .sbd nested mbox 1 at a time:
$ echo oldSrcmbox newDstMaildirNoDot | 
  { read src dst ; mkdir -p .nestedMaildir.$dst/{cur,new,tmp} ; 
  /path/mbox2Maildir.py 
    ../mbox/OldNestedmbox.sbd/$src 
    .newNestedMaildir.$dst ; }


Batch Conversion (Read List Of mbox Names From stdin):
$ { while read folder ; 
  do echo ; echo '---'; echo Converting $folder ; 
  mkdir -p .NewNestedMaildir.$folder/{cur,new,tmp} ; 
  /path/mbox2Maildir.py ../mbox/OldNestedmbox.sbd/$folder 
  .NewNestedMaildir.$folder ; done ; }



Note:
This syntax:
  mkdir -p .nestedMaildir.$dst/{cur,new,tmp}
is mkdir 3 directories at a time -- 
  .nestedMaildir.$dst/new, etc.


After all (or each one), start Evolution, 
click to open the new folder,
and click away to another folder
to trigger the loading of the new mail folder.

Hope that workaround the mail conversion problem.


-- 
Daniel Yek.


> On Wed, 2011-09-07 at 11:05 +0200, Paul Menzel wrote:
> > Am Dienstag, den 06.09.2011, 09:00 -0600 schrieb linux guy:
> > > I updated from F14 to F15 and in the process from Evolution 2.x to 3.0.2.
> > > 
> > > There were numerous (non Evolution) issues during the update process.
> > > Somehow the Evolution mail conversion tool got interrupted and thus only
> > > about 10% of my emails were converted to the new format.
> > > 
> > > How do I rerun the tool and convert the rest of my emails to the new 
> > > format
> > > ?
> > 
> > I submitted report #657349 [1] for this issue but was told to ask on the
> > mailing list. Milan commented to manually copy all the messages [2].
> > 
> > Having over 40 folders I would welcome another solution though.
> > 

#!/usr/bin/python 

# Usage:
# /path/mbox2Maildir.py mboxName MaildirName

import mailbox
import os.path
import re
import sys

try:
    appname = os.path.split( sys.argv[0] )[1]
    basename = os.path.splitext( appname )[0]
    source = sys.argv[1]
    dest = sys.argv[2]

    # This breaks maildir2mbox into "maildir" and "mbox".
    (sfmt, dfmt) = re.match(r'^(.+)2(.+)', basename).groups()

    # Samples for the following lines are:
    #   sbox = mailbox.__dict__['Maildir']('../maildir', factory=None)
    #   dbox = mailbox.__dict__['mbox']('Inbox_mbox')

    # Avoid problematic default rfc822.Message factory, 
    # which caused this error:
    #   File "/usr/lib/python2.6/mailbox.py", line 331, 
    #       in get_message msg.set_subdir(subdir)
    #   AttributeError: Message instance has no attribute 'set_subdir'
    sbox = mailbox.__dict__[sfmt](source, factory=None)

    dbox = mailbox.__dict__[dfmt](dest)

    for key in sbox.iterkeys():
        dbox.add( sbox.get_message(key) )

except IndexError:
    sys.exit('Usage: %s source destination' % appname)
except (AttributeError, KeyError):
    sys.exit('ERROR: invalid mailbox type')
except mailbox.Error, err:
    sys.exit('ERROR: %s' % err)

_______________________________________________
evolution-list mailing list
evolution-list@gnome.org
To change your list options or unsubscribe, visit ...
http://mail.gnome.org/mailman/listinfo/evolution-list

Reply via email to