[TriLUG] Want command line program to selectively delete emails

Ed Blackman via TriLUG trilug at trilug.org
Mon Jul 17 13:46:26 EDT 2023


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. For example, from high traffic lists: if I haven't read it in 30 days, chances are I never will, so the script saves me from having to manually go in and purge.

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

When I recently upgraded to Debian 12, I found that archivemail has been removed from Debian because it's a Python 2 program that hasn't been touched in a long time.

I gave a Python3 port of archivemail an hour, but just barely got to the point that the full test suite ran and gave me 70 failures out of 100 tests.

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

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), but I thought I'd see if there's something that I could just install.

-- 
Ed Blackman


More information about the TriLUG mailing list