Want command line program to selectively delete emails

Ed Blackman ed at edgewood.to
Sun Aug 6 23:18:47 UTC 2023


On Sat, Aug 05, 2023 at 09:16:35AM -0700, googly.negotiator862 at aceecat.org wrote:
> On Fri, Aug 04, 2023 at 10:56:18PM +0200, Marcus C. Gottwald wrote:
> 
> >    find ~/mail/folder1/cur/ -maxdepth 1 -type f -not -name '.*' \
> >                             -mtime +30 \
> >                             -not -name '*:2,*F*' \
> >                             -delete
> 
> > The conditions in the first line are generic, the other three
> > lines should match your example: received more than 30 full days
> > ago && not flagged => delete.
> 
> I think an mtime test is not the same as "date received" test.
> 
> You may have created the folder by recursive copy from somewhere
> else, just to take the most obvious problem. Some of us also love
> mutt's ability to modify messages after they're delivered (the E,
> & and # keys).

Since I'm running it to purge emails, the worst case here is that a recursive copy would reset the clock on the purge countdown.  Since my purpose is to have the emails disappear eventually without me having to do it manually, that's not a showstopper for me.

> I think for a true date received test, you have to look at the
> timestamp part of the filename. Or look at the message headers, but
> this would be much slower.

archivemail reads the headers, and I'd actually prefer that.  It's just hard to do with find.

-- 
Ed Blackman


More information about the Mutt-users mailing list