MBAR

NAME
SYNOPSIS
DESCRIPTION
OPTIONS
EXIT CODES
SEE ALSO
DOWNLOADS
AUTHORS
BUG REPORTS
COPYRIGHT

NAME

mbar − mailbox archiver

SYNOPSIS

mbar [OPTION] DIR DEST [EXPR]

DESCRIPTION

Scans directory DIR for mailboxes matching pattern (by default - *, i.e. all mailboxes). For each mailbox, messages matching the supplied criteria are picked and moved to the mailbox of the same name, located under the directory DEST. If the destination mailbox doesn’t exist, it will be created with the necessary intermediate directory, so that directory hierarchy under DEST is identical to that under DIR.

When no selection criteria are supplied, mbar moves all messages in each mailbox.

The −b (−−before−date) option instructs mbar to archive only messages received before the date indicated by its argument. A wide variety of date formats are understood. For a detailed discussion of them, see http://mailutils.org/manual/html_section/Date-Input-Formats.html.

The following example will archive messages received more than one year ago:

mbar -b ’1 year ago’ /var/mail /var/backups/mail

The utility works by creating a Sieve script using the supplied criterion as a condition and by executing this script on each mailbox encountered.

More complex criteria can be provided using the EXPR optional argument. The value of this argument must be a valid Sieve conditional suitable for use in the if statement.

The script is built from a template, by expanding the following macro variables:

cond

Expands to the condition expression

dest

Expands to the name of the destination mailbox.

requires

Expands to a comma-separated list of additional requires needed for successful compilation of the Sieve script. Such additional requires are supplied via the −r (−−require) command line option.

keep

Expands to 1 if the −k (−−keep) option is given and to empty string otherwise.

The default template script is:

require ["fileinto"${requires}];
if ${cond} {
    fileinto "${dest}";${keep:+keep;}
}

The -b DATE option is a shortcut for specifying

timestamp :before "Date" "DATE"

as EXPR.

OPTIONS

−b, −−before−date=DATE

Archive messages received before DATE

−c, −−compile−only

Compile script and exit

−D, −−dump

Compile script, dump disassembled sieve code to terminal and exit

−f, −−template−file=FILE

Read template from FILE.

−i, −−instructions

Sieve instruction trace.

−−locus

Show action locations with verbose output.

−m, −−maxdepth=NUM

Limits nesting depth to NUM directories.

−−mailbox−type=TYPE

Set type of destination mailboxes.

−n, −−dry−run

Don’t do anything: print what would be done.

−p, −−pattern=PAT

Archive mailboxes matching pattern (default is *).

−r, −−require=MODULE

Require MODULE in the produced Sieve script.

−t, −−trace

Sieve trace.

−v, −−verbose

Verbosely print what is being done.

EXIT CODES

The exit codes conform with /usr/include/sysexits.h:

0

Success.

64 (EX_USAGE)

Command line usage error.

69 (EX_UNAVAILABLE)

Unable to create mailbox or intermediate directories.

70 (EX_SOFTWARE)

Internal software error. Please report if you ever encounter this exit code.

78 (EX_CONFIG)

Configuration file error.

SEE ALSO

http://mailutils.org/manual/html_chapter/Sieve-Language.html.

DOWNLOADS

Mbar is available for download from this location.

The latest version is mbar-1.0.

Recent news, changes and bugfixes can be tracked from the project's development page.

AUTHORS

Sergey Poznyakoff

BUG REPORTS

Report bugs to <gray@gnu.org>.

COPYRIGHT

Copyright © 2016, 2019 Sergey Poznyakoff
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law.


Manpage server at Ulysses.gnu.org.ua.

Powered by mansrv 1.0