MAIL-EXPIRE(1)

๐Ÿ“ฆ
version 0.9.2 ยท 3 versions
, in debian trixie, ubuntu noble, ubuntu questing

๐Ÿ’Œ MAIL-EXPIRE โ€” the mail-expire era ๐Ÿ’Œ

okay bestie, so we're talking about mail-expire(1) today, a User Commands girlie, and honestly? she's lowkey iconic. she goes through your mbox files and pulls out the crusty old messages so your mail folders stop looking like a hoarder's basement. let's get into it ๐Ÿ’…


โœจ NAME โœจ

mail-expire โ€” a program whose whole entire job is extracting outdated messages from mbox files. that's it. that's the gig. ๐ŸŽ€


๐Ÿฆ‹ SYNOPSIS ๐Ÿฆ‹

mail-expire AGE-IN-DAYS FILES...

๐Ÿ’– DESCRIPTION ๐Ÿ’–

so mail-expire is this lil utility and its one (1) purpose in life is helping you keep the size of multiple mail folders as small as needed โ€” by literally removing the outdated messages. decluttering queen. ๐Ÿงนโœจ

For input, both Maildir and Mailbox formats are supported, and this manual page mentions both types interchangeably, no cap. The output goes to Mailbox files tho, just so we're clear.

The old messages get compressed with gzip or xz and stored in a file with a name following the pattern MBOXNAME.MONTH_YEAR.gz (or something similar). The reference time used for the output filename is calculated from the current time minus the number of days you specified in the first parameter. math is mathing. ๐Ÿงฎ

If a file with the same name already exists, the default storage strategy is to append a new compressed region to the existing file (unless the -u option is used, we'll get there). This means, for example, you can run the expiration in a cron job every weekend while collecting all mails from (roughly) each month into dedicated buckets. cute, organized, monthly-bucket energy. ๐Ÿชฃ

The drawback of this appending mode? a slightly reduced compression ratio. The advantage? reduced disk usage all the time. And also, such archives can later be recompressed separately to archive the highest compression ratio, like:

mv x.xz x.old.xz && xzcat x.old.xz | xz -9 > x.xz && rm xz.old.xz

๐ŸŒธ SPACE REQUIREMENTS ๐ŸŒธ

  • For Mbox input: you need additional disk space to store the amount of fresh messages plus a portion of the size of expired messages (depending on the output compression).
  • For Maildir input: only additional space for a portion of the size of expired messages (depending on the output compression) is required. lighter! ๐Ÿชถ

๐Ÿ”ฅ OPTIONS ๐Ÿ”ฅ

mail-expire recognizes the following options, bestie. read them all, don't skim (i see you skimming):

  • -u โ€” If an existing archive file with the expected filename is found, another filename is to be chosen. This happens by appending a suffix like (NUMBER) to the basename.
ngl this is a legacy option, and it's not compatible with any custom output command. old school fr fr.
  • -t DIR โ€” Specifies a different target directory for storing expired mailbox files. Default is the current directory.
  • -T FILEBASE โ€” Explicit output target file name for all inputs (i.e. merging all expired mails into the same target mbox). This mostly disables automated name generation (base name and date suffix) โ€” only the compression suffix (-c option and related) is appended.
  • --sfx-fmt FORMAT โ€” Format string, see strftime or date manpage. โœจ
  • --dry-run, -n โ€” Only examine input files and directories, no mail data is moved around. a lil vibe check, nothing more. ๐Ÿ‘€
  • --delete, -d โ€” Drop the old messages. No backup will be made, be careful with this option. ๐Ÿ’€
  • --keep, -k โ€” Copy the expired messages to output files and keep them in the input file. best of both worlds.
  • --purge=VALUE, -p VALUE โ€” Specify how to remove input files or folders after becoming empty:
    • 0: never remove
    • 1 (default): remove empty files but keep folders (also related folders)
    • 2: remove empty Mbox file and Maildir
    • 3: like 2 but also remove the input file if it was empty
  • -v LEVEL โ€” Verbosity level, where 0 produces no output except for errors, 1 some progress messages, 2 and more verbose progress messages. ๐Ÿ—ฃ๏ธ
  • -c output-shell-command โ€” A shell script fragment which is run in order to archive the data. The default or current value can be displayed with the -v2 option.
๐Ÿšจ okay this command is very delicate, it might literally destroy the target file. It might also be suspicious to shell injection attacks, so quotes are important. handle with care bestie, this one is not a game.
  • -X โ€” Shortcut for the -c and -s options, compressing with the XZ compressor (multiple threads) and .xz file suffix.
  • -Z โ€” Shortcut for the -c and -s options, compressing with the Zstandard compressor (zstd or zstdmt where available) and .zstd file suffix.
  • -U โ€” Shortcut for the -c and -s options, to not compress the output and not have an additional suffix. raw dogging the bytes, respect. ๐Ÿซถ
  • -l โ€” Lockless operation, input Mailboxes are assumed to be not touched by other tools while mail-expire runs. By default, it attempts to mimic the behavior of procmail to prevent it from file modifications. This option has no effect on Maildir type input. To be used with care:
โš ๏ธ runtime conflicts with procmail or other tools MIGHT CAUSE DATA LOSS. not dramatic, just true. ๐Ÿ˜ญ

๐Ÿ‘‘ AUTHOR ๐Ÿ‘‘

This manual page was written by Eduard Bloch. Permission is granted to use, copy, distribute and/or modify this document under the terms of the MIT license. giving legal rights, we love to see it ๐Ÿ’œ


okay that's the whole page bestie, you're officially a mail-expire scholar ๐ŸŽ“โœจ

this has been mail-expire 0.9.2+nmu1, dated 2023-06-15, signing off โ€” go forth and expire those messages, you gorgeous main character ๐ŸŒˆ๐Ÿ’–๐Ÿฆ‹

๐Ÿ“ฆ where this page comes from