(*** This bug was imported into bugs.kde.org ***) Package: kmail Version: 1.4 (using KDE 3.0.0 ) Severity: wishlist Installed from: compiled sources Compiler: gcc version 2.95.4 (Debian prerelease) OS: Linux (i686) release 2.4.18 OS/Compiler notes: It would be very nice if kmail could convert between mboxes and maildirs. One can do this by hand if one copies all messages to a new folder and changes names filters inboxes etc. by hand so kmail already does the hard stuff. It would be nice to automate this however. Thank you very much! (Submitted via bugs.kde.org) (Called from KBugReport dialog)
*** Bug 56444 has been marked as a duplicate of this bug. ***
We will probably add the possibility to convert mbox to maildir in a future version of KMail. Until then you can use the following method which I used to convert about 80 mbox folders to maildir. But first a warning: This method worked _for me_ without problems. It should only be used by experienced Linux/Unix users. Make a backup of your ~/Mail directory before you start with the conversion. You have been warned. Preparation: Set the preferred format for folders to maildir so that new folders automatically use this format. Furthermore make sure that you have enough free disk space. You need more free disk space than the total size of all folders you want to convert. The algorithm: Let's assume that the to-be-converted folder is named "Folder" (without the quotes of course). 1.) Create a new folder with the name "Folder.new". This folder has to be a sibling of "Folder", i. e. if "Folder" is a top-level folder then "Folder.new" must also be a top-level folder and if "Folder" is a subfolder of another folder then "Folder.new" has to be a subfolder of the same folder as "Folder". 2.) Select all messages in "Folder" (Edit->Select All Messages) and move them to "Folder.new". As a first check you should compare the number of messages before moving with the number of messages after moving. The number of messages is shown in the status bar and, in case you enabled the Total column, in the Total column of the folder view. 3.) After moving all messages "Folder" should now look empty. In order to really empty "Folder" (the moved messages are only marked as deleted, but they are still in the mbox file) you must now apply Folder->Move All Messages To Trash on "Folder". 4.) Repeat steps 1 - 3 for all folders you want to convert. 5.) Quit KMail and wait until KMail has really stopped running. In KDE 3.1 this is indicated by a progress dialog. In previous versions of KDE you have to check for a running kmail process, e. g. on Linux with 'ps ux | grep kmail | grep -v grep'. 6.) Change into the directory ~/Mail (with 'cd ~/Mail'). 7.) If "Folder" is a top-level folder (like inbox, sent-mail, etc.) then run the attached script with mbox2maildir.sh Folder If "Folder" is a subfolder of let's say the top-level folder "Parentfolder" then you have to run the attached script with mbox2maildir.sh .Parentfolder.directory/Folder If "Folder" is on a deeper level of your folder hierarchy then you have to tell mbox2maildir.sh the complete relative path to this folder. The script will perform a few checks in order to make sure that it's safe to make the conversion and then it will replace all files belonging to the old mbox folder "Folder" with the files belonging to the new maildir folder "Folder.new". 8.) Repeat step 7 for all folders you want to convert. Below you will find a command which automates steps 7 and 8. 9.) Restart KMail and verify that the conversion worked. Advanced method for applying step 7 automatically to all folders which need to be converted (use at your own risk): find . -name '*.new' | \ perl -e 'while (<>) { s/.new\n//; printf("%s\x00",$_); }' | \ xargs -0 -l1 mbox2maildir.sh Q: Why use this method instead of the method proposed in the FAQ? A: - This method also works for the five standard folders "inbox", "outbox", "trash", "sent-mail" and "drafts" which can't be deleted from within KMail. - You don't lose any folder settings (like mailing-list address, expiration date, identity). - All filters still work after the conversion.
Created attachment 1250 [details] the shell script used to convert mbox to maildir
Subject: Re: conversion between mbox and maildir folders On Thursday 27 March 2003 10:45, you wrote: > 7.) If "Folder" is a top-level folder (like inbox, sent-mail, etc.) then > run the attached script with mbox2maildir.sh Folder I know how the KMail folder structure is set up and I also know mbox2maildir. What I did not know is that KMail apparently automatically detects upon startup that the folder changed format. I didn't dare to try that myself :) Solves the issue for me, but I'll leave the report open for others as a GUI option is still a good idea to have. PS: Why copy the mails to the temporary folder? At work we once converted quite a few mailboxes with contents from mbox to maildir when moving from sendmail to qmail and that worked perfectly. Saves a lot of steps and basically simplifies your steps to the following: 1. Stop KMail 2. Run mbox2maildir on the required folders 3. Start KMail again
Subject: Re: conversion between mbox and maildir folders When I last looked for something like mbox2maildir I didn't find anything. Therefore I wrote my rather complicated howto. OTOH, I'm not sure if using mbox2maildir is really safe since after the conversion the index files are probably outdated (resp. KMail might think so). Do the message flags (which KMail stores in the index) survive the conversion? What about messages which are marked as deleted? Do they reappear after the conversion?
Subject: kdepim/kmailcvt CVS commit by landers: Initial mbox import filter CCMAIL: 42537@bugs.kde.org A filter_mbox.cxx 1.1 A filter_mbox.hxx 1.1 M +3 -2 Makefile.am 1.18 --- kdepim/kmailcvt/Makefile.am #1.17:1.18 @@ -5,5 +5,6 @@ filters.cxx filter_pab.cxx filter_oe.cxx kmailcvt.cpp \ main.cpp filter_eudora_ab.cxx filter_ldif.cxx \ - filter_pmail.cxx filter_plain.cxx filter_csv.cxx + filter_pmail.cxx filter_plain.cxx filter_csv.cxx \ + filter_mbox.cxx kmailcvt_LDADD = -lkabc $(LIB_KFILE) @@ -17,5 +18,5 @@ filter_ldif.cxx filter_pmail.cxx filter_pmail.hxx \ filter_plain.cxx filter_plain.hxx \ - filter_csv.cxx filter_csv.hxx + filter_csv.cxx filter_csv.hxx filter_mbox.cxx filter_mbox.hxx install-data-local: uninstall.desktop
Fixed.
Is this feature implemented in KDE 3.3.1 yet? If so, it doesn't seem to be in an intuitive place. I expect to be able to right-click on a folder, view its properties, and change the format from mbox to maildir. However, I can't convert folders this way.
I've been in contact with Michael Jahn, who marked this bug report as fixed. He claims that there may exist functionality to convert between mbox and maildir in kmailcvt. However, I've run kmailcvt and I'm fairly certain that there's no obvious way to use it to convert folders between mbox and maildir -- at least, not in KDE 3.3.2; I haven't tried the latest CVS. At any rate, even if kmailcvt can do it, that seems a very unintuitive way of going about it. Most users will be expecting that they can simply right-click on a mailbox, open the properties dialog, and then change the mailbox format via the drop-down list. I think this alone would justify reopening the bug report...
Seems I was a little too eager closing this bug, as I can't find this feature. Hmmm. Thanks Tristan.
I just tried Martijn Klingens's suggestion of running a mbox2maildir conversion script directly on the KMail folders. This didn't work; when I restarted KMail everything looked as normal (i.e., unread/total message count for the converted folder was as before, and the message list in the folder was normal), but when I actually clicked on a message to read it, I got a blank message, and the information in the message list for that message disappeared. I suppose this is because the index files KMail creates depend on whether the folder is mbox or maildir. Perhaps the solution is as simple as forcing KMail to rebuild the index files, but I have no idea how to do this. I don't want to use the method Ingo Klöcker proposes because it's not automatic -- you still need to manually create a replacement folder for every folder to be converted and move the messages in. This would take far too long for a user with a hundred folders; I'm amazed Ingo had the patience to do it with eighty. If someone can provide a script to convert KMail mbox to maildir *fully* automatically, without loss of information, I'm willing to pay a bounty. Get in touch with me and we can work something out.
I assume that conversion from maildir to mbox will be also present.
PS. This issue is a serious problem because as I found out default folders are undeletable. So user cannot convert inbox (for example) by creating tmp folder, moving all messages, deleting inbox, and renaming tmp to inbox.
Thank you for your feature request. Kmail1 is currently unmaintained so we are closing all wishes. Please feel free to reopen a feature request for Kmail2 if it has not already been implemented. Thank you for your understanding.
Instead of creating a new feature request, please confirm here if the wishlist is still valid for kmail2.