.\" @(#) /u/des/src/sortmail/sortmail.man 1.2 98/09/12 15:38:01 .\" Copyright (c) 1998, Daniel E. Singer .\" All Rights Reserved .\" view this document using [tn]roff with the -man option .TH sortmail 1 "12 September 1998" "Toolman" .\" ------------------------------------------------------------------------ .\" define string D to be a dash appropriate for nroff or troff .if n .ds D - .if t .ds D \- .SH NAME sortmail \*D sort email messages by date/time .SH SYNOPSIS .BR sortmail " [ " \*DchHmMyYrRvx " ] " .I mbox... .br .\" ------------------------------------------------------------------------ .SH DESCRIPTION .B sortmail is a front end for .BR decomposemail (1) and .BR recomposemail (1). Each mailbox argument is disassembled into its component messages, then these messages are reassembled into new mailboxes based on command line selection criteria. Some additional functionality is provided, such as backup copies, recursion, etc. .\" ------------------------------------------------------------------------ .SH OPTIONS The following options are supported: .TP 10 .B \*Dc Move current month mailbox back to original mailbox, implies .B \*Dr (for use with .BR \*Dm , .BR \*DM , .BR \*Dy , or .BR \*DY ). .TP .BR \*Dh Help, just print an informational message, and exit. .TP .BR \*DH Here, do work in the current directory instead of in .IR ./SM_WORK . .TP .BR \*Dm Sort to monthly mailboxes of type .IR mbox.YYMM . .TP .BR \*DM Sort to monthly mailboxes of type .IR YYMM/mbox . .TP .BR \*Dy Sort to yearly mailboxes of type .IR mbox.YYYY . .TP .BR \*DY Sort to yearly mailboxes of type .IR YYYY/mbox . With .BR \*Dm , sort to mailboxes of type .IR YYYY/mbox.MM . With .BR \*DM , sort to mailboxes of type .IR YYYY/MM/mbox . .TP .BR \*Dr Remove (replace) the original mailbox after sorting. .TP .BR \*DR Recurse, redo any appended mailboxes (for use with .BR \*Dm , .BR \*DM , .BR \*Dy , or .BR \*DY ). .TP .BR \*Dv Verbose, even \fImore\fR messages. .TP .BR \*Dx Don't make any backup copies in .IR ./SM_BACKUP . .\" ------------------------------------------------------------------------ .SH OPERANDS The following operands are supported: .TP 10 .IR mbox The name (with optional path) of a standard Internet style mailbox file. .\" ------------------------------------------------------------------------ .SH USAGE .B sortmail can help to organize saved email for archival and retrieval purposes. Messages are sorted by date/time, then reassembled into new mailboxes. A notable feature is the ability to separate the messages into monthly or yearly mailboxes. .PP The default behavior is to take each \fImbox\fR (mailbox) argument, make a backup copy, make a working copy, decompose it into individual message files, and then recompose the messages ordered by date in increasing order. .PP With the .B \*Dm flag, the messages are reassembled into separate files per month, \fImbox.YYMM\fR; for example, \*(lqmlist.9801\*(rq. With the .B \*DM flag, the messages are reassembled into separate files per month in subdirectories, \fIYYMM/mbox\fR; for example, \*(lq9801/mlist\*(rq. With the .B \*Dy flag, the messages are reassembled into separate files per year, \fImbox.YYYY\fR; for example, \*(lqmlist.1998\*(rq. With the .B \*DY flag, the messages are reassembled into separate files per year in subdirectories, \fIYYYY/mbox\fR; for example, \*(lq1998/mlist\*(rq. If .B \*DY is combined with .BR \*Dm , the messages are reassembled into separate files per month in yearly subdirectories, \fIYYYY/mbox.MM\fR; for example, \*(lq1998/mlist.01\*(rq. If .B \*DY is combined with .BR \*DM , the messages are reassembled into separate files per month in yearly and monthly subdirectories, \fIYYYY/MM/mbox\fR; for example, \*(lq1998/01/mlist\*(rq. In any of these cases, any such pre-existing mailboxes will be appended. If any such pre-existing mailboxes are compressed (\fI.Z\fR or \fI.gz\fR), they will first be uncompressed, and then recompressed after being modified. .PP With the .B \*Dc flag (along with .BR \*Dm , .BR \*DM , .BR \*Dy , or .BR \*DY ), the \fImbox\fR file for the current month (if any) will be renamed as the original \fImbox\fR. .PP With the .B \*DR flag (along with .BR \*Dm , .BR \*DM , .BR \*Dy , or .BR \*DY ), when a month file is combined with one that already exists, the resulting file will be resorted. .PP With the .B \*DH flag, all work is done in the current directory instead of in .IR ./SM_WORK . This reduces the usefulness of some of the other options, and is a bit riskier. (Also known as \*(lqthe gonzo option\*(rq.) .PP By default, all work is done in a subdirectory .IR ./SM_WORK , and all files to be modified are backed up in a subdirectory .IR ./SM_BACKUP . These subdirectories are created if they don't already exist. These are not cleaned up after sorting, though none of the temporary message files or sort files should remain. .PP Much of this can be accomplished using .BR decomposemail (1) and .BR recomposemail (1) directly, but many more manual steps are required. .\" ------------------------------------------------------------------------ .SH EXAMPLES Sort the messages in the mailbox \*(lqmail/CERT\*(rq, not making a backup copy in \fI./SM_BACKUP\fR, and rename the new sorted mailbox to the original mailbox. Without \fB\*Dr\fR, the new mailbox would remain in \*(lq./SM_WORK\*(rq: .PP \fBsortmail \*Dxr mail/CERT\fR .PP Sort the messages in the mailbox \*(lqFreeBSD\*(rq, separating messages by month into mailboxes like \*(lqFreeBSD.9801\*(rq, \*(lqFreeBSD.9802\*(rq, etc. The original mailbox will be overwitten with any messages for the current month: .PP \fBsortmail \*Dmc FreeBSD\fR .PP Sort the messages in the mailboxes \*(lqmaya\*(rq and \*(lqjim\*(rq, separating messages by month into mailboxes in subdirectories like \*(lq9801/maya\*(rq, \*(lq9801/jim\*(rq, \*(lq9802/maya\*(rq, \*(lq9802/jim\*(rq, etc. Any such pre-existing mailboxes that are appended will also be resorted: .PP \fBsortmail \*DMR maya jim\fR .PP Sort the messages in the mailbox \*(lqyada\*(rq, separating messages by month into mailboxes in subdirectories like \*(lq1998/01/yada\*(rq, \*(lq1998/02/yada\*(rq, etc. Any such pre-existing mailboxes that are appended will also be resorted, and the original mailbox will be overwitten with any messages for the current month: .PP \fBsortmail \*DYMcR yada\fR .\" ------------------------------------------------------------------------ .SH FILES .TP 14 .B ./SM_BACKUP Directory where \fBsortmail\fR makes a backup copy of each mailbox before sorting it. .TP .B ./SM_WORK Directory where \fBsortmail\fR does its work: makes a temporary copy of each \fImbox\fR, and a serialized file for each message. .TP .I mbox.YYYYMMDD.hhmmss.nnnnn Temporary serialized files for each individual message in a mailbox, where \*(lqmbox\*(rq is the name of the mailbox, \*(lqYYYYMMDD\*(rq is the year, month, and day, \*(lqhhmmss\*(rq is the hour, minute, and second, and \*(lqnnnnn\*(rq is a serialization number. These will be created in the \fB./SM_WORK\fR directory, unless the .B \*DH flag is specified. .\" ------------------------------------------------------------------------ .SH DIAGNOSTICS Returns \fB0\fR if no problems encountered. .br Returns \fBnon-zero\fR for any errors encountered. .\" ------------------------------------------------------------------------ .SH BUGS \fBsortmail\fP is a shell script that uses the filesystem for sorting. .I It is slow. .PP Due to copies made during the sorting process, you should have enough additional space in your current partition and/or quota to hold three full copies of each original \fImbox\fR. .PP \fBsortmail\fP is quite verbose, even without the \fB\*Dv\fR option. A quiet option should be added. .PP Data at the beginning of a mailbox that does not appear to be part of an email message will be silently discarded. .PP \fBsortmail\fP creates working directories and backup copies of mailboxes, and does not clean up after itself (except as noted above). .PP \fBsortmail\fP relies on the scripts .BR decomposemail (1) and .BR recomposemail (1). This is either a bug or a feature. .\" ------------------------------------------------------------------------ .SH "SEE ALSO" .BR compress (1), .BR decomposemail (1), .BR gzip (1), .BR recomposemail (1), .BR sh (1); .br .B mailsort (Perl script, available from CPAN sites); .br \*(lqToolman: Sorting and Archiving Email\*(rq, \fI;login:\fR magazine (USENIX Association), August 1998; .br . .\" ------------------------------------------------------------------------ .SH AUTHOR \fBsortmail\fR was written by Daniel E. Singer (a.k.a. Toolman) at the Department of Computer Science, Duke University.