procmail
[Top] [All Lists]

Re: Converting message files to mbox

2002-02-01 19:48:56
Kenneth Porter asked,

| I'm changing mail clients and need to migrate directories of individual
| messages (names like GXYZ01.MSG) to mbox files.

I'll take your word for that, but could the names be more like msg.gxyz01?

| From scanning the
| archives it looks like formail might do it, but I haven't seen a
| complete solution yet.  The date on the From line can probably be the
| time stamp for each file.

If you want to combine all the messages in each directory into one file,
which one's From_ line gets to determine the timestamp on the file?

Anyhow, I gather that the messages already have From_ lines, then.  So, er,
isn't

 for directoryname in pattern
  do cat $directoryname/*.msg > $directoryname.mbox
 done

If you want them in timestamp order, then I'd suggest a slight variation on
Sean's advice:

 for directoryname in pattern
 do
  cat `ls -rt $directoryname/*.msg` > $directoryname.mbox
 done

In either case, if not all the messages have From_ lines, change the
pertinent line from

 cat whatever > $directoryname.mbox

to

 cat whatever | formail -s > $directoryname.mbox

and if the files are named msg.gxyz01 and such, replace "*.msg" with
"msg.*".



_______________________________________________
procmail mailing list
procmail(_at_)lists(_dot_)RWTH-Aachen(_dot_)DE
http://MailMan.RWTH-Aachen.DE/mailman/listinfo/procmail

<Prev in Thread] Current Thread [Next in Thread>