Home > archmbox > archmbox -x

archmbox(1) -x
a simple email archiver
-x, --regexp <header=regexp>
       It is specified in form -x field='regexp', where field can be any header. The header part is  case
       sensitive.  The  regexp  part  is  case  sensitive  if the regexp contains at least one upper case
       letter, and case insensitive otherwise.
       If message satisfies date range, but does not satisfy regexp match on  specified field,  it  won't
       be archived.
       The  option  can  be specified more than once; in this case, the message is regexp matched against
       all the given rules, and if it satisfies any, it will be archived.

Examples

A complete example:
archmbox -a -b -c -e 01 -f -d 2002-01-01 -p ~/mail-archive ~/Mail/personal-stuff
This will archive all messages older than (received before...) Jan 1st 2002 from the personal-stuff mailbox in the Mail directory. Archive messages are saved in a mailbox called Mail-personal-stuff.01.gz in the ~/mail-archive directory. After execution, you'll find a mailbox called personal-stuff.backup in ~/Mail.
Complex examples, using perl regular expressions:
archmbox -a -o 1 --keep-flagged --keep-unread \ -x From='(nagios|arpwatch|logcheck)@host\.net' \ -x Subject='^(Security Events|Syslog Summary|\[SNORT\])' \ ~/Mail/inbox
This will archive all unflagged, read messages older than 1 day where the sender address matches nagios@host.net, arpwatch@host.net or logcheck@host.net or whose subject field starts with either 'Security Events' or 'Syslog Summary' or '[SNORT]' from the mailbox ~/Mail/inbox. Messages will be saved in inbox.archive in the current directory where archmbox was started from.
archmbox --archive --offset 1 --keep-flagged --keep-unread \ --Regexp From='@(host1|host2).example\.com' \ --regexp Subject='^(Security Events|Syslog Summary|\[SNORT\])' \ --archive-path ~/Mail/local-network.archive \ --archive-name system-msgs \ --extension 'none' \ ~/Mail/inbox
This will archive all unflagged, read messages older than 1 day where the sender address matches @host1.example.com or @host2.example.com and whose subject field starts with either 'Security Events' or 'Syslog Summary' or '[SNORT]' from the mailbox ~/Mail/inbox. Messages will be archived to the mbox system-msgs in the directory ~/Mail/local-network.archive.
Some simpler examples:
archmbox -a -o 15 ~/Mail/personal-stuff
This will archive all messages older than 15 days in personal-stuff.archived (uncompressed mailbox).
archmbox -a -r -o 15 ~/Mail/personal-stuff
The same as above, but only messages newer than 15 days will be archived.
archmbox -k -o 15 ~/Mail/personal-stuff
This will delete all messages older than 15 days from Mail/personal-stuff
archmbox -a -o 15 ~/Mail/* -c
This will archive all messages older than 15 days in every mailbox found in ~/Mail. All the archive mailboxes will be compressed.
archmbox -l -r -c /tmp/mbox -o 20
List all messages in /tmp/mbox which are newer than 20 days. Option -c is meaningless (and so ignored...).
archmbox -l -r -c /tmp/mbox -o 20 -a --bzip2
Same as above, but archiving is forced (-a) and bzip2 is used for compression.
archmbox -a -x Subject='archmbox' -o 7 ~/mbox
Select for archiving all messages older than 7 days whose subject field satisfies regexp match Subject =~ /archmbox/ (Subject is case sensitive, archmbox is is case insensitive).
archmbox -l -x Subject='archmbox' -x From='fritz' -o 7 ~/mbox
Select for archiving all messages older than 7 days whose subject field contains archmbox or the sender is fritz (matches are case insensitive).
archmbox -l -x Subject='archmbox' -X From='fritz' -o 7 ~/mbox
Select for archiving all messages older than 7 days whose subject field contains archmbox and the sender is fritz (matches are case insensitive).
archmbox -a -o 5 -R /tmp/mbox ~/Mail
archmbox will archive all messages older than five days in /tmp/mbox. It then start parsing all mailboxes stored in ~/Mail (recursion is active, and ~/Mail is a directory). If one or more directories will be found in ~/Mail, those directories will be explored as well.
archmbox -a -o -1 ~/Mail/my_mbx_mailbox --format mbx
archmbox archives all messages stored in my_mbx_mailbox and puts them into my_mbx_mailbox.archived. The source mailbox is a mbx mailbox (--format mbx is used). The archive mailbox will be a mbox mailbox.

Tips or Questions?


Powered by ExplainShell