MAIL-EXPIRE(1)
๐ 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 (-coption and related) is appended.--sfx-fmt FORMATโ Format string, seestrftimeordatemanpage. โจ--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 remove1(default): remove empty files but keep folders (also related folders)2: remove empty Mbox file and Maildir3: like2but also remove the input file if it was empty
-v LEVELโ Verbosity level, where0produces no output except for errors,1some progress messages,2and 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-v2option.
๐จ 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-cand-soptions, compressing with the XZ compressor (multiple threads) and.xzfile suffix.-Zโ Shortcut for the-cand-soptions, compressing with the Zstandard compressor (zstdorzstdmtwhere available) and.zstdfile suffix.-Uโ Shortcut for the-cand-soptions, 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 whilemail-expireruns. 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
- debian trixie: mail-expire 0.9.2+nmu1
- ubuntu noble: mail-expire 0.9.2+nmu1
- ubuntu questing: mail-expire 0.9.2+nmu1
- ๐ girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms