Ed Blackman wrote (Fri 2023-Aug-04 14:34:44 -0400):
> ... remove emails that were received more than X days ago, but can also
> express "but don't delete if they're flagged".
..
> 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".
That's what I'd probably do. It might be simpler than expected:
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.
If you also want to delete mails that "have not yet been seen by
any mail application" [1], let "find" also look at new/. Entries
in new/ never contain an info part (the stuff after the colon),
so you can drop the check for an unset "F" flag if you need to
invoke "find" separately for new/ anyway.
[1] https://en.wikipedia.org/wiki/Maildir
Cheers, Marcus
--
Marcus C. Gottwald · <[email protected]> · @mcg:cheers.de