Any suggestions for a command line program to select emails for deletion based 
on command line options?  I specifically want one that can remove emails that 
were received more than X days ago, but can also express "but don't delete if 
they're flagged".

I had been using archivemail 
(https://manpages.debian.org/buster/archivemail/archivemail.1.en.html) from 
cron to delete emails in certain folders. It saves me from having to manually 
go in and purge folders for lists that I want to have available, but don't ever 
read old messages.

It allows commands like:
 archivemail --quiet --delete --days=30 ~/mail/folder1/
 archivemail --quiet --delete --days=30 --include-flagged ~/mail/folder2/

It supports reading Maildir, IMAP, mbox, MH, but the mailboxes I need to purge 
are all maildir.

When I recently upgraded to Debian 12, I found that archivemail has been 
removed from Debian because it's an unmaintained Python 2 program.

I could probably port archivemail to Python3 with enough time.

I could compile Python2 from source, but don't want to.

I could call mutt (see, kinda OT!) with "-e" to tag, delete, sync, and quit, 
but that seems fiddly and heavyweight.

I could extract the interesting parts of archivemail into my own script (most 
of the script is about *archiving* email, which I'm not interested in).

I could give up on using the message headers to determine the message date, 
learn how filenames are constructed in Maildir (to read the flags) and use a 
shell script built around "find".

None of those options are great, so I thought I'd see if there's something that 
I could just install.

-- 
Ed Blackman

Reply via email to