| ARCHIVEMAIL(1) | archivemail user manual | ARCHIVEMAIL(1) |
NAME¶
archivemail - archive and compress your old emailSYNOPSIS¶
archivemail
[ options] {MAILBOX...}
DESCRIPTION¶
OPTIONS¶
-d NUM, --days=NUMArchive messages older than NUM days.
The default is 180. This option is incompatible with the --date option
below.
-D DATE, --date=DATE
Archive messages older than DATE.
DATE can be a date string in ISO format (eg “2002-04-23”),
Internet format (eg “23 Apr 2002”) or Internet format with full
month names (eg “23 April 2002”). Two-digit years are not
supported. This option is incompatible with the --days option
above.
-o PATH, --output-dir=PATH
Use the directory name PATH to store
the mailbox archives. The default is the same directory as the mailbox to be
read.
-P FILE, --pwfile=FILE
Read IMAP password from file FILE
instead of from the command line. Note that this will probably not work if you
are archiving folders from more than one IMAP account.
-F STRING, --filter-append=STRING
Append STRING to the IMAP filter
string. For IMAP wizards.
-p NAME, --prefix=NAME
Prefix NAME to the archive name.
NAME is expanded by the python(1) function
time.strftime(), which means that you can specify special directives in
NAME to make an archive named after the archive cut-off date. See the
discussion of the --suffix option for a list of valid strftime()
directives. The default is not to add a prefix.
-s NAME, --suffix=NAME
Use the suffix NAME to create the
filename used for archives. The default is _archive, unless a prefix is
specified.
Like a prefix, the suffix NAME is expanded by the python(1)
function time.strftime() with the archive cut-off date.
time.strftime() understands the following directives:
-a NAME, --archive-name=NAME
- %a
- Locale's abbreviated weekday name.
- %A
- Locale's full weekday name.
- %b
- Locale's abbreviated month name.
- %B
- Locale's full month name.
- %c
- Locale's appropriate date and time representation.
- %d
- Day of the month as a decimal number [01,31].
- %H
- Hour (24-hour clock) as a decimal number [00,23].
- %I
- Hour (12-hour clock) as a decimal number [01,12].
- %j
- Day of the year as a decimal number [001,366].
- %m
- Month as a decimal number [01,12].
- %M
- Minute as a decimal number [00,59].
- %p
- Locale's equivalent of either AM or PM.
- %S
- Second as a decimal number [00,61]. (1)
- %U
- Week number of the year (Sunday as the first day of the week) as a decimal number [00,53]. All days in a new year preceding the first Sunday are considered to be in week 0.
- %w
- Weekday as a decimal number [0(Sunday),6].
- %W
- Week number of the year (Monday as the first day of the week) as a decimal number [00,53]. All days in a new year preceding the first Sunday are considered to be in week 0.
- %x
- Locale's appropriate date representation.
- %X
- Locale's appropriate time representation.
- %y
- Year without century as a decimal number [00,99].
- %Y
- Year with century as a decimal number.
- %Z
- Time zone name (or by no characters if no time zone exists).
- %%
- A literal “%” character.
Use NAME as the archive name, ignoring
the name of the mailbox that is archived. Like prefixes and suffixes,
NAME is expanded by time.strftime() with the archive cut-off
date. Because it hard-codes the archive name, this option cannot be used when
archiving multiple mailboxes.
-S NUM, --size=NUM
Only archive messages that are NUM
bytes or greater.
-n, --dry-run
Don't write to any files -- just show what
would have been done. This is useful for testing to see how many messages
would have been archived.
-u, --preserve-unread
Do not archive any messages that have not yet
been read. archivemail determines if a message in a mbox-format or
MH-format mailbox has been read by looking at the Status header (if it
exists). If the status header is equal to “RO” or “OR”
then archivemail assumes the message has been read. archivemail
determines if a maildir message has been read by looking at the filename. If
the filename contains an “S” after :2, then it assumes the message
has been read.
--dont-mangle
Do not mangle lines in message bodies
beginning with “From ”. When archiving a message from a
mailbox not in mbox format, by default archivemail mangles such lines
by prepending a “>” to them, since mail user agents might
otherwise interpret these lines as message separators. Messages from mbox
folders are never mangled. See mbox(5) for more information.
--delete
Delete rather than archive old mail. Use this
option with caution!
--copy
Copy rather than archive old mail. Creates an
archive, but the archived messages are not deleted from the originating
mailbox, which is left unchanged. This is a complement to the --delete
option, and mainly useful for testing purposes. Note that multiple passes will
create duplicates, since messages are blindly appended to an existing
archive.
--all
Archive all messages, without
distinction.
--include-flagged
Normally messages that are flagged important
are not archived or deleted. If you specify this option, these messages can be
archived or deleted just like any other message.
--no-compress
Do not compress any archives.
--warn-duplicate
Warn about duplicate Message-IDs that appear
in the input mailbox.
-v, --verbose
Reports lots of extra debugging information
about what is going on.
--debug-imap=NUM
Set IMAP debugging level. This makes
archivemail dump its conversation with the IMAP server and some
internal IMAP processing to stdout. Higher values for NUM give more
elaborate output. Set NUM to 4 to see all exchanged IMAP commands.
(Actually, NUM is just passed literally to imaplib.Debug.)
-q, --quiet
Turns on quiet mode. Do not print any
statistics about how many messages were archived. This should be used if you
are running archivemail from cron.
-V, --version
Display the version of archivemail and
exit.
-h, --help
Display brief summary information about how to
run archivemail.
NOTES¶
IMAP¶
When archivemail processes an IMAP folder, all messages in that folder will have their \Recent flag unset, and they will probably not show up as “new” in your user agent later on. There is no way around this, it's just how IMAP works. This does not apply, however, if you run archivemail with the options --dry-run or --copy.EXAMPLES¶
To archive all messages in the mailbox debian-user that are older than 180 days to a compressed mailbox called debian-user_archive.gz in the current directory:bash$ archivemail debian-user
bash$ archivemail --suffix '_%B_%Y' debian-user
bash$ archivemail --date='1 Jan 2002' cm-melb
bash$ archivemail --date=2002-01-01 cm-melb
bash$ archivemail --delete --days=30 spam
bash$ archivemail --preserve-unread incoming
bash$ archivemail --no-compress received
bash$ archivemail -d90 -o $HOME/Mail/Archive $HOME/Mail/*
bash$ archivemail -o $HOME/Mail/Archive imaps://user:'"'$PASSWORD'"'@example.org/INBOX
bash$ archivemail --pwfile=~/imap-pass.txt imaps://user@example.org/foo/*
TIPS¶
Probably the best way to run archivemail is from your crontab(5) file, using the --quiet option. Don't forget to try the --dry-run and perhaps the --copy option for non-destructive testing.EXIT STATUS¶
Normally the exit status is 0. Nonzero indicates an unexpected error.BUGS¶
If an IMAP mailbox path contains slashes, the archive filename will be derived from the basename of the mailbox. If the server's folder separator differs from the Unix slash and is used in the IMAP URL, however, the whole path will be considered the basename of the mailbox. E.g. the two URLs imap://user@example.com/folder/subfolder and imap://user@example.com/folder.subfolder will be archived in subfolder_archive.gz and folder.subfolder_archive.gz, respectively, although they might refer to the same IMAP mailbox.SEE ALSO¶
mbox(5), crontab(5), python(1), procmail(1)URL¶
The archivemail home page is currently hosted at sourceforge[1]AUTHOR¶
This manual page was written by Paul Rodger <paul at paulrodger dot com>. Updated and supplemented by Nikolaus Schulz microschulz@web.deNOTES¶
- 1.
- sourceforge
| 5 July 2011 | archivemail 0.9.0 |