Re: Converting individual messages to mbox format

From: Martin Schulze <joey_at_finlandia.Infodrom.North.DE_at_hypermail-project.org>
Date: Thu, 28 Oct 1999 21:45:00 +0200
Message-ID: <19991028214500.M23156_at_finlandia.infodrom.north.de>


Pat Barron wrote:
> I have a directory (actually, a few hundred directories....) containing a
> bunch of files. Each file contains a single e-mail message, in RFC822
> format. Can anyone point me to a utility to gather up all those files,
> and convert them to a single "mbox" format file, suitable for feeding into
> Hypermail?

find -type f|while read f; do cat $f >> /foo/bar/mbox; done

If they're in proper RFC822 format, i.e. start with From_ and end with a newline, that's it. If not, you want to use formail -f or something in between.

> I do have to be able to preserve the message dates, so any solution
> must get the message date from the RFC822 "Date:" header, and put it into
> the mbox "From_" line.

Ah, cat $f|formail -f or something similar.

Regards,

        Joey

-- 
Beware of bugs in the above code; I have only proved it correct,
not tried it.  -- Donald E. Knuth
Received on Thu 28 Oct 1999 11:04:17 PM GMT

This archive was generated by hypermail 2.2.0 : Thu 22 Feb 2007 07:33:51 PM GMT GMT