Any number of existing mailboxes may be given as arguments. If the mailboxes are in the locations where Mail.app would look for them the pathname and the `.mbox' extension may be dropped.
If another program (typically either Mail.app or appnmail ) has locked a mailbox which the program tries to access, it will sleep for 10 seconds and try again until the mailbox has become available. If compactmail is invoked with the -n option a warning message will be given instead and the mailbox skipped. Adding the option -v causes compactmail to be more verbose about what it does. The -r option causes compactmail to expunge not only all deleted, but all messages which aren't unread. The -u flag goes even further and makes compactmail expunge all messages regardless of status.
Those wondering what possible use a flag to delete all messages could be will be relieved to hear that there are options to restrict this option to a subset of all messages. To restrict the operation of compactmail to only messages with a certain subject use -s regexp and only messages matching regexp will be compacted. The -f regexp option fulfills the same function for the `From' line of messages. Finally the -d days options restrict compactmail to only deleting messages at least days days old.
Expunge all read or deleted message in the OldMail mailbox from cedman which are at least two weeks old.
compactmail -r -d 14 -f cedman@ OldMail
This program will confuse EnhanceMail full-text indices. Don't use it on EnhanceMail indexed mailboxes.
The task was made considerably easier by Chris Paris <cap+@cmu.edu> decoding of the Mail.app transmission and storage formats.