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

Re: thunderbird: how to backup mailbox and restore quickly



[This message has also been posted to linux.debian.user.]
In article <7Ue7H-4r7-27@gated-at.bofh.it>, Jörg-Volker Peetz wrote:
> Yuwen Dai wrote:
>> I'd like to backup part of my Inbox, e.g., the emails of last year as my
>> Inbox becomes larger and larger. I also want to restore and read the
>> backup quick in thunderbird if need.  What's your suggestion?
>
> How about creating a new folder, e.g., Inbox-2005. Then move all mails
> to be backed up into this folder. Archive this folder with soumething like
>
> tar czf Inbox-2005.tgz ./.thunderbird/.../Inbox-2005*
>
> (The three dots "..." have to be replaced by the exact path)
> Afterwards this folder can be removed. In case you need it back, just
> stop thunderbird, un-tar the backup archive file, and restart
> thunderbird again.

The last time I looked, Thunderbird stored mail
in ~/.mozilla-thunderbird/[stuff].default/Mail/[account name]/
Each "folder" was a text file in the old, ugly, standard mbox format.
It also maintains a Foldername.msf (message summary file?) file
that gives kind of an overview of the corresponding mbox, but
if mbox.msf is missing it will just read the mbox and generate
a new one.

You can bust an mbox file into individual messages with "formail -s".
You can sort them any which way with procmail.
Do something like this while Thunderbird is not running:

$ formail -s < mboxfile | procmail recipefile 

recipefile looks like this:

  :0:
  * ^Received: .* myserver.example.net ;.* Dec 2006
  /home/me/December

  :0:
  * ^Received: .* myserver.example.net ;.* Nov 2006
  /home/me/November

  ...

$ Local=".mozilla-thunderbird/bletch.default/Mail/Local Folders"
$ mv December November "$Local"


Sure beats sorting them in Thunderbird's GUI.
You'll have to look at your mail headers to figure out
regular expressions to match the messages you want to pick.
I'm using the final Received line because the date is
more reliable there than in Date: lines sent by random
Windoze users.  Notice the cumbersome quoting to preserve
the space in the directory name.

When you start Thunderbird it will
create "Local Folders/November.msf" etc.

Similarly you can move obsolete mbox files out of
..mozilla-thunderbird and compress or make tarfiles
or whatever.  Just do it while
Thunderbird is not running so it doesn't get confused,
and don't forget to remove the corresponding .msf files.

They're just mbox files.  In a pinch you can open
them with mailx and save groups of messages to a new
mbox file (or onto the end of an old one) with its "s"
command.  Good old mailx.

I haven't tried this in a while.  Test it first, and let
me know if it doesn't work any more.  Thanks


Cameron








Reply to: