MHonArc v2.5 -- Common Tasks

# Common Tasks

The following section describes how to perform some common tasks with MHonArc archives beyond those mentioned in Quick Start. To get a complete picture of what you can do with MHonArc, see the section on Resources.

- Setting the Index Title
- Changing Index Listing Order
- Removing Messages
  - Automatic Removal
  - Manual Removal

## Setting the Index Title

If you read the Quick Start section and ran MHonArc on some of your mail, you have may have noticed that the titles of the main (date) and thread index pages are not very descriptive: "Mail Index" and "Mail Thread Index". It would be much nicer if the the titles reflect what type of mail is in the archive. For example, if the archive contains messages from a mailing list, the name of the list should probably be in the title.

MHonArc allows you to change the titles via the `-title` and `-ttitle` options. The `-title` option sets main index title, and the `-ttitle` option sets the thread index title. Example:

        shell> mhonarc -title "The Widget List Archive" \
                       -ttitle "The Widget List Thread Archive" ...

## Changing Index Listing Order

By default, messages get listed in chronological order on the main/non-thread and thread index pages.

NOTE | The chronological order in the thread index is based on the root messages of each thread.

For many, the default listing order is not what is desired. A common desire is to have messages in the main index listed in reverse chronological order; ie. the most recent messages are listed first while the oldest are listed last. Or, one may want to list messages by author since the target audience is more interested in looking up messages by certain authors than by date.

Following is the list options available for changing the listing order on index pages:

Option | Description
`-authsort` | Sort main index by author.
`-reverse` | Reverse the listing order in the main index.
`-sort` | List messages by date in main index.
`-subsort` | List messages by subjext in main index.
`-treverse` | List thread in reverse order.
`-tsort` | List threads by date.
`-tsubsort` | List threads by subject.

For example, to get a reverse chronological listing, do something like the following:

        shell> mhonarc -sort -reverse ...

## Removing Messages

There are two ways to delete messages from an archive: automatic and manual.

### Automatic Removal

MHonArc supports the ability to automatically remove archive messages that are older than a specified time period, are older than a specified date/time, or the number of messages have reached the maximum number specified.

For example, if you want an archive to only contain messages that are less than a month, you can do something like the following:

        shell> mhonarc -expireage 2635200 -add -outdir /path/to/archive mailbox

Here, we used the `-expireage` option to tell MHonArc to remove messages older than 2635200 seconds (30.5 days) when adding new messages. I know, having to use seconds to specify the expiration age seems cumbersome. A table is provided in the EXPIREAGE reference page listing common time periods to their equivalence in seconds.

A less used option that will cause automatic deletion is the `-expiredate` option. This allows you to specify an exact date/time where any messages older than the given date/time, will be automatically removed. For example:

        shell> mhonarc -expiredate "1 Jan 1999 00:00:00" -add -outdir /path/to/archive mailbox

In this example, before MHonArc adds any new messages, it will delete any messages with a date earlier than January 1, 1999. See the EXPIREDATE reference page for more information and for the correct expiration date syntax.

An archive can also have a maximum number of messages limit. When the maximum number is reached, the oldest messages are automatically removed. The following is an example of setting the maximum size of an archive:

        shell> mhonarc -maxsize 500 -add -outdir /path/to/archive mailbox

### Manual Removal

Sometimes it becomes necessary to remove specific messages from archive. For example, their may be some spam messages and you do not want them cluttering your archive (and providing free advertising). Or, there may be archived messages that you believe are not appropriate for the archive's intended audience.

To remove specific messages, use the `-rmm` option. For example:

        shell> mhonarc -rmm 24 28 39 48

will delete messages 24, 28, 39, and 48.

You are now asking, "How do I know what a message's number is?". One way is to look at the number in the message's filename. I.e. Each converted message is writting to a filename containing the number of message. For example, `msg00024.html`, `msg00028.html`, `msg00039.html`, and `msg00048.html` denote messages 24, 28, 39, and 48.

Checking filenames can be awkward, so one alternative is to use the `-scan` option. For example:

        shell> mhonarc -scan -outdir /home/ehood/html/archive
        Reading database ...
        117 messages in /home/ehood/html/archive:

        Msg #  YYYY/MM/DD  From             Subject
        -----  ----------  ---------------  -------------------------------------------
           62  1996/07/30  Kwin Kramer      Reading STDIN not from keyboard -- or, Syst
           23  1996/07/31  Christopher M.   Re: Setting @INC to include my own modules
    	9  1996/08/01  Dan Kirkwood     object as hash key loses methods
    	2  1996/08/01  James F'jord Ly  Re: We're HIRING hot hackers!
    	1  1996/08/01  Christopher Cha  Curious Multi-Dimensional array behavior
           14  1996/08/01  I R A Aggie      Re: Patch for arithmetic bug in 5.003 ?
    	3  1996/08/01  Bernard Bellon   Re: How do you grab a URL in perl?
           38  1996/08/01  Mohammed Dewan   Help needed badly win3.1 and perl.
           59  1996/08/01  Mohammed Dewan   Using file in perl.
    	4  1996/08/01  Dan Gildor       Re: Threaded Discusion groups embeded in We
    	5  1996/08/01  kendall shaw     addicted to emacs lisp
    	6  1996/08/01  Ye He            Q: Sybase extension to Perl
           83  1996/08/01  I R A Aggie      Re: Browser/Page matching CGI script
    	7  1996/08/01  Chris Schleiche  Re: Simple program looks good, but gives er
           13  1996/08/01  Steve McCullagh  Perl 5.002 and $| errors
        ...

With -scan, you can get a listing of an archive to your terminal. The listing can be used to determine the message number for a message if you know the message's subject and author.

The `-rmm` also supports the ability to specify message number ranges and message-ids. See the RMM reference page for more information and examples.