Merging mail backup with current

Top Page
Attachments:
Message as email
+ (text/plain)
Delete this message
Reply to this message
Author: Kurt Granroth
Date:  
Subject: Merging mail backup with current
On Monday 08 October 2001 07:58 am, Alan Dayley wrote:
> What I am really looking for it a way to take the email files that are live
> right now in my Kmail and MERGE them with the backup. For example, in the
> live Kmail I have an Inbox folder. In my backup set there is also an Inbox
> folder. How do I merge the contents of both Inbox folders so I only have
> one.
>
> The only way I can think of is to do the process you have described, naming
> a folder "OldInbox," copy the backup Inbox file to this file name, run
> Kmail and drag the email from Old to current and then delete the old
> folder. I just thought that maybe there would be something "slicker" that
> that.


Okay, that would indeed work AND would be *by far* the safest way to do this.

But there are faster and slicker ways.. if slightly more "dangerous".

CAUTION: BACKUP ALL OF YOUR MAIL BEFORE DOING THIS!!!

The KMail that you are using stores it's mail in standard "mbox" or Berkely
Mailbox style files. This is a single text file with all of the messages in
it. To combine or merge two mailboxes, then, all you have to do is merge
or combine the two text files.

So say you have $HOME/Mail/inbox and $HOME/OldMail/oldinbox and you want
the former to have all of the messages of the latter. You can do this
like so:

cat $HOME/OldMail/oldinbox >> $HOME/Mail/inbox

That will append the contents of oldinbox onto inbox. KMail will then take
care of ordering the messages by date when you start it up the first time.

Be *very* careful about using that command.  Make sure you use >> and *NOT*
just >.  If you use only one > then you will overwrite inbox instead of
appending to it.
--
Kurt Granroth            | http://www.granroth.org
KDE Developer/Evangelist | SuSE Labs Open Source Developer
         | 
            KDE -- Conquer Your Desktop