On Mon, Feb 15, 2021 at 04:21:11PM +0000, Chris Green wrote:
> This isn't specifically mutt but it's definitely to do with managing
> mail and there's lots of knowledgeable people here.
> 
> I currently have the following two lines in my crontab to delete old
> mails in my junk catching directories, is it OK/safe to do it like
> this? 
> 
>     20 02 * * * find /home/chris/mail/Ju/*/cur -type f -mtime +7 -exec rm {} 
> \;
>     30 02 * * * find /home/chris/mail/Ju/*/new -type f -mtime +7 -exec rm {} 
> \;

If you have software expecting to be able to read or write to the files
affected by the above commands, then if that software is not able to
handle the sudden disappearance of those files, it may throw errors or
otherwise misbehave.  Software designed to work with Maildirs should
not have problems, though.

Also, unless I am mistaken, `find ... -exec rm () \;` is not atomic, so
a race condition exists: `find` could find a matching file, but then
some other piece of software could delete or rename it before `rm` does.

(If I am mistaken, someone please correct me!)

Finally, I suppose that to be technically correct, you perhaps ought to
first move the files from "new" to "cur", and then delete them from
"cur".  A true mail guru may be able to shed light on this.

IMO, the likelihood is low that any of these issues will bite you.

Sam

-- 
A: When it messes up the order in which people normally read text.
Q: When is top-posting a bad thing?

()  ASCII ribbon campaign. Please avoid HTML emails & proprietary
/\  file formats. (Why? See e.g. https://v.gd/jrmGbS ). Thank you.

Reply via email to