[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kmail-devel
Subject:    [Bug 42537] conversion between mbox and maildir folders
From:       Ingo "Klöcker" <kloecker () kde ! org>
Date:       2003-03-27 9:45:14
[Download RAW message or body]

------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.
     
http://bugs.kde.org/show_bug.cgi?id=42537     
kloecker@kde.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
      everconfirmed|0                           |1



------- Additional Comments From kloecker@kde.org  2003-03-27 10:45 -------
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.
_______________________________________________
KMail Developers mailing list
kmail@mail.kde.org
http://mail.kde.org/mailman/listinfo/kmail
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic