On Mon, 13 Dec 1999 14:48:43 +0100 (MET),
Martin Mokrejs <mmokrejs(_at_)natur(_dot_)cuni(_dot_)cz> said:
M> On Sun, 12 Dec 1999, S.Toms wrote:
I'm wondering if someone would know a way to do this, my sent folder is
in excess of 5mb at this time, and I was wanting to seperate it out into
individual folders based on month and year...
M> shell$ formail -b -s /usr/majordomo/perl/bin/mhonarc -rcfile \
M> /usr/local/www/apache/share/cgi/.wilma/krb4.rc -add < \
M> ../../krb4.archive/krb4.9910
M> So now everything works, but requires little bit too much memory/cpu to
M> my taste. ;-)
I have a program called "spmail" which I use to split mailboxes into
separate messages or by date. Part of the man entry is below. Let me
know if you're interested.
--
Karl Vogel
ASC/YCOA, Wright-Patterson AFB, OH 45433, USA
vogelke(_at_)c17mis(_dot_)region2(_dot_)wpafb(_dot_)af(_dot_)mil or
kvogel(_at_)sumaria(_dot_)com
Instead of getting married again, I'm going to find a
woman I don't like and give her a house. --Lewis Grizzard
---------------------------------------------------------------------------
NAME
spmail - splits a Berkeley-style mailbox into separate files
SYNOPSIS
spmail [-s start] [-p path] mbox
spmail [-m|-w|-d|-h|-y] [-p path] mbox
spmail -v
DESCRIPTION
spmail splits a Berkeley-style mail file "mbox" into
separate files by message, day, hour, week, month, or year.
In all cases, a directory called data/mbox is created to
hold the individual messages, where mbox is the basename of
the original mail file.
Splitting by Message
The first form of the command creates sub-directories
beneath data/mbox with the names "0", "1", ...
The first sub-directory (0) contains files with the names
"001" through "999". Each remaining sub-directory contains
files with the names "000" through "999". Each file con-
tains a single mail message.
Splitting by Date
If splitting by date, mail is appended to files beneath
data/mbox as follows:
If splitting by output mailbox name looks like
day YYYY-MM-DD
hour YYYY-MM-DDHH
month YYYY-MM
week YYYYwNN
year YYYY
OPTIONS
-v prints the version number and exits.
-s num accepts a number at which the file creation is to
begin. Default is 0. Only valid when splitting
by message.
-p path accepts a pathname which is to serve as the top-
level directory, instead of "data/mbox".
-d splits mailbox by day.
-h splits mailbox by hour.
-m splits mailbox by month.
-w splits mailbox by week.
-y splits mailbox by year.
NOTES
The regular expression used to search for the start of a
mail message is
"\n\nFrom .* (Jan|Feb|...|Nov|Dec) .* [0-9][0-9]:[0-9][0-9]"
ERRORS
Exits with If
0 Everything is OK.
1 Usage error.
2 Problem finding the mailbox file to split.
EXAMPLES
Splitting by message:
These examples assume the existence of a file called sample
containing 63 mail messages in Berkeley format, with dates ranging
from 15 October 1995 to 19 July 1996.
% ls -l data
ls: data: No such file or directory
% ls -l sample
-rw-r--r-- 1 mail mail 221667 Nov 21 1997 sample
% spmail sample
% ls -R data
data/sample:
0
data/sample/0:
001 009 017 025 033 041 049 057
002 010 018 026 034 042 050 058
003 011 019 027 035 043 051 059
004 012 020 028 036 044 052 060
005 013 021 029 037 045 053 061
006 014 022 030 038 046 054 062
007 015 023 031 039 047 055 063
008 016 024 032 040 048 056
Splitting by date:
% spmail -d sample
opening 1995-10-15
opening 1995-11-17
opening 1995-12-01
opening 1995-12-12
...
% (cd ./data/sample; ls -l)
-rw-r--r-- 1 bin bin 725 Dec 15 17:25 1995-10-15
-rw-r--r-- 1 bin bin 1319 Dec 15 17:25 1995-11-17
-rw-r--r-- 1 bin bin 672 Dec 15 17:25 1995-12-01
-rw-r--r-- 1 bin bin 2191 Dec 15 17:25 1995-12-12
...
-rw-r--r-- 1 bin bin 948 Dec 15 17:25 1996-06-23
-rw-r--r-- 1 bin bin 1834 Dec 15 17:25 1996-06-24
-rw-r--r-- 1 bin bin 498 Dec 15 17:25 1996-07-01
-rw-r--r-- 1 bin bin 19496 Dec 15 17:25 1996-07-19
% spmail -w sample
opening 1995w41
opening 1995w46
opening 1995w48
opening 1995w50
opening 1996w10
opening 1996w12
...
opening 1996w27
opening 1996w29
% (cd ./data/sample; ls -l)
-rw-r--r-- 1 bin bin 725 Dec 15 17:25 1995w41
-rw-r--r-- 1 bin bin 1319 Dec 15 17:25 1995w46
-rw-r--r-- 1 bin bin 672 Dec 15 17:25 1995w48
-rw-r--r-- 1 bin bin 2191 Dec 15 17:25 1995w50
-rw-r--r-- 1 bin bin 19495 Dec 15 17:25 1996w10
-rw-r--r-- 1 bin bin 19496 Dec 15 17:25 1996w12
-rw-r--r-- 1 bin bin 20520 Dec 15 17:25 1996w13
-rw-r--r-- 1 bin bin 19495 Dec 15 17:25 1996w14
-rw-r--r-- 1 bin bin 22806 Dec 15 17:25 1996w16
-rw-r--r-- 1 bin bin 20946 Dec 15 17:25 1996w17
-rw-r--r-- 1 bin bin 20080 Dec 15 17:25 1996w18
-rw-r--r-- 1 bin bin 16949 Dec 15 17:25 1996w19
-rw-r--r-- 1 bin bin 1016 Dec 15 17:25 1996w20
-rw-r--r-- 1 bin bin 4095 Dec 15 17:25 1996w22
-rw-r--r-- 1 bin bin 25274 Dec 15 17:25 1996w23
-rw-r--r-- 1 bin bin 1930 Dec 15 17:25 1996w24
-rw-r--r-- 1 bin bin 948 Dec 15 17:25 1996w25
-rw-r--r-- 1 bin bin 1834 Dec 15 17:25 1996w26
-rw-r--r-- 1 bin bin 498 Dec 15 17:25 1996w27
-rw-r--r-- 1 bin bin 19496 Dec 15 17:25 1996w29
AUTHOR
Karl Vogel
<vogelke(_at_)c17mis(_dot_)region2(_dot_)wpafb(_dot_)af(_dot_)mil>
Sumaria Systems, Inc.