Want command line program to selectively delete emails

Derek Martin invalid at pizzashack.org
Wed Aug 9 15:57:31 UTC 2023


On Sun, Aug 06, 2023 at 09:32:26AM -0700, googly.negotiator862 at aceecat.org wrote:
> On Sun, Aug 06, 2023 at 04:04:34PM +0200, Marcus C. Gottwald wrote:
> 
> > > I think for a true date received test, you have to look at the
> > > timestamp part of the filename.
> 
> > Well, it looks like both mtime and timestamp-as-part-of-filename may
> > change when copying messages between Maildirs, at least when using
> > Mutt and a local filesystem. So if mtimes do not reflect the desired
> > timestamp, neither might timestamp-as-part-of-filename.

Note that copying a message creates a new message, which is
"delivered" (and also "received") at the time it was copied.  So that
is consistent.

> I was thinking of just using cp and friends, and yes I have done that
> to move around my maildirs.

cp -rp preserves times, and other file metadata, on a recursive copy.
If you're copying mail, e.g. for archival purposes (though there are
arguably better methods), you want this.

However I would strongly suggest that manipulating mail with programs
that are not designed to manipulate mail is only not a terrible idea
when you know what you're doing...  If you do this and don't know what
you're doing, you get what you get.  If you didn't know that you could
copy files and retain their metadata, you should perhaps consider that
you may not sufficiently know what you're doing, and rely on your
mailer to do this properly for you.

> I'm curious if mutt preserves the mtime when doing the mutating
> operations I mentioned ie. rethreading or editing after the fact.
> Especially in the case of editing, I have serious doubts that mtime
> is preserved.

Editing a message creates a new message, which as above is "delivered"
at the time it is created.  I don't know for a fact that mutt does not
retain the original message's file metadata, but I would not expect it
to do so.  The original message is marked as deleted, but you can
un-delete it so it is retained.  In any case the edited message is not
the original and there's no reason it should *necessarily* retain the
original's metadata--I can see an argument for it but would myself
consider that counterintuitive.

All in all, Marcus' suggestion is a pretty reasonable one.  But you
might look at GNU Mailutils, which I think might be able to do much of
what you're looking for.

-- 
Derek D. Martin    http://www.pizzashack.org/   GPG Key ID: 0xDFBEAD02
-=-=-=-=-
This message is posted from an invalid address.  Replying to it will result in
undeliverable mail due to spam prevention.  Sorry for the inconvenience.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
URL: <http://lists.mutt.org/pipermail/mutt-users/attachments/20230809/509c7f76/attachment-0001.asc>


More information about the Mutt-users mailing list