Re: Deleting old maildir messages, is what I'm doing OK?

2021-02-17 Thread Remco Rijnders
On Mon, Feb 15, 2021 at 05:07:54PM +, Chris wrote in 
<20210215170754.GA532393@esprimo>:

Does no one else ever delete mail messges? :-)


I use the following in my .muttrc:

# Folder hooks
folder-hook =Junk 'push ~r>14d'

This sets to delete mails older than 14 days from my Junk folder any time I open
that folder. This way it allows me to scan all the mails for possible falls
positives without having to worry mail gets lost if I haven't checked it for
more than x days.


Re: Deleting old maildir messages, is what I'm doing OK?

2021-02-15 Thread Patrick Shanahan
* Cameron Simpson  [02-15-21 17:06]:
> On 15Feb2021 17:07, Chris Green  wrote:
> >Does no one else ever delete mail messges? :-)
> 
> Hmm:
> 
> [~/mail]fleet2*1> ls -ldh spam*
> -rw-rw-r--  1 cameron  cameron   1.7G 16 Feb 08:43 spam
> -rw-rw-r--  1 cameron  cameron   609M 16 Feb 08:46 spam-definite
> 
> Possibly not.
> 
> Can you tell mairix to not index the Junk folders?

certainly
omit=
in .mairixrc


-- 
(paka)Patrick Shanahan   Plainfield, Indiana, USA  @ptilopteri
http://en.opensuse.orgopenSUSE Community Memberfacebook/ptilopteri
Photos: http://wahoo.no-ip.org/piwigo   paka @ IRCnet freenode


Re: Deleting old maildir messages, is what I'm doing OK?

2021-02-15 Thread Cameron Simpson
On 16Feb2021 09:05, Cameron Simpson  wrote:
>On 15Feb2021 17:07, Chris Green  wrote:
>>Does no one else ever delete mail messges? :-)
>
>Hmm:
>[~/mail]fleet2*1> ls -ldh spam*
>-rw-rw-r--  1 cameron  cameron   1.7G 16 Feb 08:43 spam
>-rw-rw-r--  1 cameron  cameron   609M 16 Feb 08:46 spam-definite

The other thing of note here is that these are mbox folders (like many 
of my less visited folders, for compactness). You could just move them 
sideways and remove "old" sideways folders? I guess that works for 
Maildir too, now that I think about it.

Cheers,
Cameron Simpson 


Re: Deleting old maildir messages, is what I'm doing OK?

2021-02-15 Thread Cameron Simpson
On 15Feb2021 17:07, Chris Green  wrote:
>Does no one else ever delete mail messges? :-)

Hmm:

[~/mail]fleet2*1> ls -ldh spam*
-rw-rw-r--  1 cameron  cameron   1.7G 16 Feb 08:43 spam
-rw-rw-r--  1 cameron  cameron   609M 16 Feb 08:46 spam-definite

Possibly not.

Can you tell mairix to not index the Junk folders?

Cheers,
Cameron Simpson 


Re: Deleting old maildir messages, is what I'm doing OK?

2021-02-15 Thread Felix Finch

On 20210215, Angel M Alganza wrote:

On Mon, Feb 15, 2021 at 12:49:53PM -0800, Felix Finch wrote:

On 20210215, Kevin J. McCarthy wrote:

You could write a script, I guess, something like:

cd $header_cache_dir
rm -f *


How well would that play with existing mutt sessions?  I run several 
mutts inside tmux (local mail, work IMAP mail, etc), and sessions 
will run for weeks.


With no problem.  When it doesn't find a cache, it'll make a new one.


Right, but what if it discovers the new cache while half-built?  Or what if it 
discovers no cache between the rm and the build, and they try to build it at 
the same time?

--
   ... _._. ._ ._. . _._. ._. ___ .__ ._. . .__. ._ .. ._.
Felix Finch: scarecrow repairman & wood chipper / fe...@crowfix.com
 GPG = E987 4493 C860 246C 3B1E  6477 7838 76E9 182E 8151 ITAR license #4933
I've found a solution to Fermat's Last Theorem but I see I've run out of room o


Re: Deleting old maildir messages, is what I'm doing OK?

2021-02-15 Thread Angel M Alganza

On Mon, Feb 15, 2021 at 12:49:53PM -0800, Felix Finch wrote:

On 20210215, Kevin J. McCarthy wrote:

You could write a script, I guess, something like:

cd $header_cache_dir
rm -f *


How well would that play with existing mutt sessions?  I run several 
mutts inside tmux (local mail, work IMAP mail, etc), and sessions will 
run for weeks.


With no problem.  When it doesn't find a cache, it'll make a new one.

Cheers,
Ángel


Re: Deleting old maildir messages, is what I'm doing OK?

2021-02-15 Thread Felix Finch

On 20210215, Kevin J. McCarthy wrote:

You could write a script, I guess, something like:

cd $header_cache_dir
rm -f *

cd $mutt_folder_dir
for mb in *; do
 mutt -e 'set quit=yes; push ""' -f $mb
done


How well would that play with existing mutt sessions?  I run several mutts 
inside tmux (local mail, work IMAP mail, etc), and sessions will run for weeks.

--
   ... _._. ._ ._. . _._. ._. ___ .__ ._. . .__. ._ .. ._.
Felix Finch: scarecrow repairman & wood chipper / fe...@crowfix.com
 GPG = E987 4493 C860 246C 3B1E  6477 7838 76E9 182E 8151 ITAR license #4933
I've found a solution to Fermat's Last Theorem but I see I've run out of room o


Re: Deleting old maildir messages, is what I'm doing OK?

2021-02-15 Thread Angel M Alganza

On Mon, Feb 15, 2021 at 08:04:10PM +, Chris Green wrote:


I have (for example) about 6000 messages in my sentmail folder, it
loads in less than a second.  It is a *lot* faster since I installed
an NVME SSD.


Well, in that case it might not be such an improvement to use the header 
cache and it could even be counterproductive to write more on the SSD.


Now, I wonder if would be worth to keep the cache in a ram disk.  I 
guess it would be much faster and don't touch the disk (better for SSD).


Well... I've gone ahead and try setting my header cache like:

  set header_cache=/tmp/ama/mutt/cache/

Since I have /tmp/ on a RAM disk, that'd do it.  It's working faster (I 
don't have the luxury of a powerful box or a SSD disk, hehe) and it will 
be deleted @reboot, so I won't have to care about deleting it manually 
from time to time.  I'm keeping it at least for now, to test it further.


Cheers,
Ángel


Re: Deleting old maildir messages, is what I'm doing OK?

2021-02-15 Thread Chris Green
On Mon, Feb 15, 2021 at 08:51:35PM +0100, Angel M Alganza wrote:
> On Mon, Feb 15, 2021 at 07:40:58PM +, Chris Green wrote:
> 
> > Where does mutt keep these header caches then?
> 
> I have 'set header_cache=~/.mutt/cache/'.
> 
> > I don't have set header_cache set for the good reason that mutt doesn't
> > download mail from anywhere, it's all here on my desktop.
> 
> The cache is for the headers, so that Mutt loads even local maildirs much
> faster.  So, I think even it might not be an issue, everybody might benefit
> from the cache.  Perhaps if you have small maildirs and/or a very powerful
> computer it doesn't make much a difference?
> 
I have (for example) about 6000 messages in my sentmail folder, it
loads in less than a second.  It is a *lot* faster since I installed
an NVME SSD.

-- 
Chris Green


Re: Deleting old maildir messages, is what I'm doing OK?

2021-02-15 Thread Kevin J. McCarthy

On Mon, Feb 15, 2021 at 10:12:50AM -0800, Felix Finch wrote:

On 20210215, Kevin J. McCarthy wrote:

once in a while you may want to regenerate your header caches.


Is there any way to do that from the command line?


You could write a script, I guess, something like:

cd $header_cache_dir
rm -f *

cd $mutt_folder_dir
for mb in *; do
  mutt -e 'set quit=yes; push ""' -f $mb
done


--
Kevin J. McCarthy
GPG Fingerprint: 8975 A9B3 3AA3 7910 385C  5308 ADEF 7684 8031 6BDA


signature.asc
Description: PGP signature


Re: Deleting old maildir messages, is what I'm doing OK?

2021-02-15 Thread Angel M Alganza

On Mon, Feb 15, 2021 at 07:40:58PM +, Chris Green wrote:


Where does mutt keep these header caches then?


I have 'set header_cache=~/.mutt/cache/'.

I don't have set header_cache set for the good reason that mutt doesn't 
download mail from anywhere, it's all here on my desktop.


The cache is for the headers, so that Mutt loads even local maildirs 
much faster.  So, I think even it might not be an issue, everybody might 
benefit from the cache.  Perhaps if you have small maildirs and/or a 
very powerful computer it doesn't make much a difference?


Cheers,
Ángel


Re: Deleting old maildir messages, is what I'm doing OK?

2021-02-15 Thread Angel M Alganza

On Mon, Feb 15, 2021 at 11:17:42AM -0800, Kevin J. McCarthy wrote:


at a certain point the cache will lose some efficiency by sheer size.


From time to time I simply delete the whole contents of my ~/.mutt/cache 
directory to keep it a bit more efficient.  A kind of prune function 
would be neat, although perhaps it's too resource intensive and that's 
why it hasn't been implemented?  Rebuilding the cache after deleting the 
whole thing doesn't seem too bad to me, as it's done maildir by maildir 
when being accessed next, so I think it's fine.


Cheers,
Ángel


Re: Deleting old maildir messages, is what I'm doing OK?

2021-02-15 Thread Chris Green
On Mon, Feb 15, 2021 at 11:17:42AM -0800, Kevin J. McCarthy wrote:
> On Mon, Feb 15, 2021 at 06:03:20PM +, Chris Green wrote:
> > Is that mutt's header caches?
> 
> Yes, that's what I meant to say. :)
> 
> > If so I don't tend to leave mutt running all the time, I assume it
> > refreshes things whenever it's started does it?
> 
> Unfortunately, for header caches, "refreshing" doesn't include removing no
> longer existing messages from the cache.  It just means the header cache
> will slowly grow, even though you are trimming the mailbox externally.  Not
> the end of the world, but at a certain point the cache will lose some
> efficiency by sheer size.
> 
Where does mutt keep these header caches then?  

Ah, just a minute, I don't have set header_cache set for the good
reason that mutt doesn't download mail from anywhere, it's all here on
my desktop.  When I read mail remotely I simply ssh to my desktop
machine and run mutt.

So I don't think this is an issue for me.

-- 
Chris Green


Re: Deleting old maildir messages, is what I'm doing OK?

2021-02-15 Thread Kevin J. McCarthy

On Mon, Feb 15, 2021 at 06:03:20PM +, Chris Green wrote:

Is that mutt's header caches?


Yes, that's what I meant to say. :)

If so I don't tend to leave mutt running all the time, I assume it 
refreshes things whenever it's started does it?


Unfortunately, for header caches, "refreshing" doesn't include removing 
no longer existing messages from the cache.  It just means the header 
cache will slowly grow, even though you are trimming the mailbox 
externally.  Not the end of the world, but at a certain point the cache 
will lose some efficiency by sheer size.


--
Kevin J. McCarthy
GPG Fingerprint: 8975 A9B3 3AA3 7910 385C  5308 ADEF 7684 8031 6BDA


signature.asc
Description: PGP signature


Re: Deleting old maildir messages, is what I'm doing OK?

2021-02-15 Thread Sam Kuper
On Mon, Feb 15, 2021 at 06:00:47PM +, Chris Green wrote:
> It's odd that none of the "maildir works like this" descriptions I
> could find had anything about deleting mails.

I agree.  That's an unfortunate gap in the literature.

-- 
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.


Re: Deleting old maildir messages, is what I'm doing OK?

2021-02-15 Thread Angel M Alganza

On Mon, Feb 15, 2021 at 06:12:39PM +, Chris Green wrote:


> mails in my junk catching directories, is it OK/safe to do it like this?



Other ones are error messages from a remote server which I
usually don't care about but occasionally I want to look at.


Oh, that's interesting.  I might be setting my own set of junk catching 
maildirs for things like those that I clean manually every now and then.



My mail is delivered by SMTP direct to my desktop machine which runs
postfix and is on all the time.  As a backup I have my domain hosting
service deliver all my mail to another system as well as to my home
server.


I synchronize (mbsyn) all email into my IMAP server to several different 
desktops, laptops and phones and, in my main desktop, I make an 
incremental backup through BTRFS snapshots that I keep for years.  So, 
at all times I have multiples copies of all email across different 
devices, a 'bak' remote IMAP maildir to keep every email for 180 days, 
and also an incremental back up.


Re-reading this last paragraph I think I might come across a little 
paranoid (and no, I don't work for a secret agency or anything, LOL), 
but I have developed the system over many years, and as I implemented 
new ideas and kept the previous, it's got those many 'layers'.  But I 
like it and it works very nicely by giving me the peace of mind that I 
can recover every single piece of g̶a̶r̶b̶a̶g̶e̶ email I might need (I will 
never, hehe, but still...)


Cheers,
Ángel


Re: Deleting old maildir messages, is what I'm doing OK?

2021-02-15 Thread Chris Green
On Mon, Feb 15, 2021 at 09:54:06AM -0800, Kevin J. McCarthy wrote:
> On Mon, Feb 15, 2021 at 04:21:11PM +, Chris Green wrote:
> > 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 {} 
> > \;
> 
> That should be fine.  The only caveat is header caching.  If you delete
> messages outside of mutt, those messages won't be removed from the header
> cache.  Probably not a big deal for "junk catching" folders, but once in a
> while you may want to regenerate your header caches.
> 
Is that mutt's header caches?  If so I don't tend to leave mutt
running all the time, I assume it refreshes things whenever it's
started does it?

-- 
Chris Green (ch...@halon.org.uk)


Re: Deleting old maildir messages, is what I'm doing OK?

2021-02-15 Thread Chris Green
On Mon, Feb 15, 2021 at 05:39:26PM +, Sam Kuper wrote:
> On Mon, Feb 15, 2021 at 04:21:11PM +, 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.
> 
Almost certainly only me using mutt to read them, and that's pretty
unlikely since they're in my junk directory. I might occasionally look
in there to check something but it's very rare, if ever.


> 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!)
> 
Yes, true, but all that will happen is that I'll get an error sent to
me so it's not really a problem.


> 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.
> 
I suppose deleting a file sort of counts as reading it.


> IMO, the likelihood is low that any of these issues will bite you.
> 
Yes, thank you, I *thought* this was so but just wanted to make sure I
wasn't doing something very obviously wrong/risky.


It's odd that none of the "maildir works like this" descriptions I
could find had anything about deleting mails.

-- 
Chris Green (ch...@halon.org.uk)


Re: Deleting old maildir messages, is what I'm doing OK?

2021-02-15 Thread Angel M Alganza

On Mon, Feb 15, 2021 at 05:07:54PM +, Chris Green wrote:


Does no one else ever delete mail messges? :-)


I do, and I try to be ruthless doing it. Since I copy every single piece 
of email into my IMAP 'bak' mailfolder, where it sits for 180 days 
before it is automatically deleted, I make sure that I can get back 
anything I might delete by mistake or modify the wrong way.  Even though 
I still have thousands and thousands of older email that I want to 
eventually tackle (meaning look through and delete), you know, when I 
get the time...  (LOL).


Cheers,
Ángel


Re: Deleting old maildir messages, is what I'm doing OK?

2021-02-15 Thread Chris Green
On Mon, Feb 15, 2021 at 09:54:06AM -0800, Kevin J. McCarthy wrote:
> On Mon, Feb 15, 2021 at 04:21:11PM +, Chris Green wrote:
> > 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 {} 
> > \;
> 
> That should be fine.  The only caveat is header caching.  If you delete
> messages outside of mutt, those messages won't be removed from the header
> cache.  Probably not a big deal for "junk catching" folders, but once in a
> while you may want to regenerate your header caches.
> 
Is that mutt's header caches?  If so I don't tend to leave mutt
running all the time, I assume it refreshes things whenever it's
started does it?

-- 
Chris Green


Re: Deleting old maildir messages, is what I'm doing OK?

2021-02-15 Thread Felix Finch

On 20210215, Kevin J. McCarthy wrote:
That should be fine.  The only caveat is header caching.  If you 
delete messages outside of mutt, those messages won't be removed from 
the header cache.  Probably not a big deal for "junk catching" 
folders, but once in a while you may want to regenerate your header 
caches.


Is there any way to do that from the command line?

--
   ... _._. ._ ._. . _._. ._. ___ .__ ._. . .__. ._ .. ._.
Felix Finch: scarecrow repairman & wood chipper / fe...@crowfix.com
 GPG = E987 4493 C860 246C 3B1E  6477 7838 76E9 182E 8151 ITAR license #4933
I've found a solution to Fermat's Last Theorem but I see I've run out of room o


Re: Deleting old maildir messages, is what I'm doing OK?

2021-02-15 Thread Chris Green
On Mon, Feb 15, 2021 at 06:55:54PM +0100, Angel M Alganza wrote:
> On Mon, Feb 15, 2021 at 04:21:11PM +, Chris Green wrote:
> 
> > 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 {} 
> > \;
> 
> Are those junk catching directories where you place email to be deleted
> temporarily, so that you don't through them right away?  Lie a Trash maildir
> of sorts?  I use trash locally and Trash remotely (at the IMAP server) to
> serve that function.
> 
They get mail directed to them that I read by other means.  For
example I'm subscribed to a number of mailing lists that are also fed
to Usenet news by Gmane.  I need to be subscribed to the lists so that
I can post messages via Gmane.  Occasionally I may need to go via
E-Mail.  Other ones are error messages from a remote server which I
usually don't care about but occasionally I want to look at.

Thus keeping the messages for a week and then automatically deleting
them makes sense for me.

[snip details about IMAP handling]

My mail is delivered by SMTP direct to my desktop machine which runs
postfix and is on all the time.  As a backup I have my domain hosting
service deliver all my mail to another system as well as to my home
server.


-- 
Chris Green (ch...@halon.org.uk)


Re: Deleting old maildir messages, is what I'm doing OK?

2021-02-15 Thread Felix Finch

On 20210215, Chris Green wrote:

On Mon, Feb 15, 2021 at 12:32:28PM -0500, José María Mateos wrote:

On Mon, Feb 15, 2021 at 05:07:54PM +, Chris Green wrote:
> Does no one else ever delete mail messges? :-)

I do, but for Junk / Trash I just set expiration times on those folders on
my e-mail provider (Fastmail) so I don't even have to think about that.


My 'e-mail provider' is me so I have to expire the messages myself,
hence the question.


I have developed an archive / delete system over the years.  I want a complete 
archive of some maildirs, so a cronjob moves them to an archive structure.  
Others I keep just a couple of weeks and then delete.  Junk/Trash/Spam sticks 
around for three days in case something came in from an unexpected source.

--
   ... _._. ._ ._. . _._. ._. ___ .__ ._. . .__. ._ .. ._.
Felix Finch: scarecrow repairman & wood chipper / fe...@crowfix.com
 GPG = E987 4493 C860 246C 3B1E  6477 7838 76E9 182E 8151 ITAR license #4933
I've found a solution to Fermat's Last Theorem but I see I've run out of room o


Re: Deleting old maildir messages, is what I'm doing OK?

2021-02-15 Thread Angel M Alganza

On Mon, Feb 15, 2021 at 04:21:11PM +, Chris Green wrote:

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 {} \;


Are those junk catching directories where you place email to be deleted 
temporarily, so that you don't through them right away?  Lie a Trash 
maildir of sorts?  I use trash locally and Trash remotely (at the IMAP 
server) to serve that function.


The first thing I do when processing email is making an automatic copy 
in the IMAP server of every email in the IMAP server through this rule:


  bak = ama["INBOX"]:is_new()
  bak : copy_messages(ama["bak"])

So, in case something goes wrong, I can always go back to the original 
mail.  My backup maildir (bak) gets deleted after 180 days, and my Trash 
maildir (IMAP) gets deleted after 30 days through this imapfilter rule:


  old = ama.bak:is_older(180)
  + ama.Trash:is_older(30)
  old : delete_messages()

Now, in some boxes I delete email but don't synchronize back the local 
trash maildir to the IMAP server (sometimes I do, but not always.  And 
then to prevent deleted email to accumulate in local maildirs I delete 
it though a couple of cron jobs very much like yours:


@daily   /usr/bin/nice find ~/mail/trash/cur/ -type f -ctime +7 -delete
@daily   /usr/bin/nice find ~/mail/trash/new/ -type f -ctime +7 -delete

I believe Mutt has no problems at all with mailfolders beeying 
manipulated externally by other programs (in fact,  I fetch my email 
with mbsync, sort email and modify subjects and such with imapfilter, 
etc., I think it's just fine deleting old junk using the find jobs as we 
both do. (Unless I'm missing something.)


Cheers,
Ángel


Re: Deleting old maildir messages, is what I'm doing OK?

2021-02-15 Thread Kevin J. McCarthy

On Mon, Feb 15, 2021 at 04:21:11PM +, Chris Green wrote:

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 {} \;


That should be fine.  The only caveat is header caching.  If you delete 
messages outside of mutt, those messages won't be removed from the 
header cache.  Probably not a big deal for "junk catching" folders, but 
once in a while you may want to regenerate your header caches.


--
Kevin J. McCarthy
GPG Fingerprint: 8975 A9B3 3AA3 7910 385C  5308 ADEF 7684 8031 6BDA


signature.asc
Description: PGP signature


Re: Deleting old maildir messages, is what I'm doing OK?

2021-02-15 Thread Sam Kuper
On Mon, Feb 15, 2021 at 04:21:11PM +, 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.


Re: Deleting old maildir messages, is what I'm doing OK?

2021-02-15 Thread Chris Green
On Mon, Feb 15, 2021 at 12:32:28PM -0500, José María Mateos wrote:
> On Mon, Feb 15, 2021 at 05:07:54PM +, Chris Green wrote:
> > Does no one else ever delete mail messges? :-)
> 
> I do, but for Junk / Trash I just set expiration times on those folders on
> my e-mail provider (Fastmail) so I don't even have to think about that.
> 
My 'e-mail provider' is me so I have to expire the messages myself,
hence the question.

-- 
Chris Green


Re: Deleting old maildir messages, is what I'm doing OK?

2021-02-15 Thread José María Mateos

On Mon, Feb 15, 2021 at 05:07:54PM +, Chris Green wrote:

Does no one else ever delete mail messges? :-)


I do, but for Junk / Trash I just set expiration times on those folders 
on my e-mail provider (Fastmail) so I don't even have to think about 
that.


Cheers,

--
José María (Chema) Mateos || https://rinzewind.org


Re: Deleting old maildir messages, is what I'm doing OK?

2021-02-15 Thread Chris Green
On Mon, Feb 15, 2021 at 05:58:25PM +0100, Matthias Beyer wrote:
> On 15-02-2021 16:38:43, Chris Green wrote:
> > On Mon, Feb 15, 2021 at 05:26:09PM +0100, Matthias Beyer wrote:
> > > On 15-02-2021 16:21:11, Chris Green wrote:
> > > > I currently have the following two lines in my crontab to delete old
> > > > mails in my junk catching directories
> > > 
> > > I mean, how many tens of GB of mail do you get each year so that
> > > it is necessary to delete stuff?
> > > 
> > Zillions of small files can make searching and stuff slow too.
> 
> May I suggest something like notmuch [0] for your mail setup?
> 
> My maildir is about 75k messages right now and searching is in the range of
> less than a second.
> Maybe you just need the right tool? ;-)
> 
I use mairix and it works fast and well.


Does no one else ever delete mail messges? :-)

-- 
Chris Green


Re: Deleting old maildir messages, is what I'm doing OK?

2021-02-15 Thread Matthias Beyer
On 15-02-2021 16:38:43, Chris Green wrote:
> On Mon, Feb 15, 2021 at 05:26:09PM +0100, Matthias Beyer wrote:
> > On 15-02-2021 16:21:11, Chris Green wrote:
> > > I currently have the following two lines in my crontab to delete old
> > > mails in my junk catching directories
> > 
> > I mean, how many tens of GB of mail do you get each year so that
> > it is necessary to delete stuff?
> > 
> Zillions of small files can make searching and stuff slow too.

May I suggest something like notmuch [0] for your mail setup?

My maildir is about 75k messages right now and searching is in the range of
less than a second.
Maybe you just need the right tool? ;-)

[0] notmuchmail.org



signature.asc
Description: PGP signature


Re: Deleting old maildir messages, is what I'm doing OK?

2021-02-15 Thread Chris Green
On Mon, Feb 15, 2021 at 05:26:09PM +0100, Matthias Beyer wrote:
> On 15-02-2021 16:21:11, Chris Green wrote:
> > I currently have the following two lines in my crontab to delete old
> > mails in my junk catching directories
> 
> May I ask why? I mean, how many tens of GB of mail do you get each year so 
> that
> it is necessary to delete stuff?
> 
It's more for 'good housekeeping' than saving space.  However I do
currently have 1.7Gb of mail which I *do* want saved in my mail
directories so adding a lot of unwanted stuff might add quite a bit.

Zillions of small files can make searching and stuff slow too.

I've just thought that I could rename the Ju directory at intervals
(say once a week) and then remove old ones.  It's not possible to make
this atomic though, I don't think.

-- 
Chris Green


Re: Deleting old maildir messages, is what I'm doing OK?

2021-02-15 Thread Matthias Beyer
On 15-02-2021 16:21:11, Chris Green wrote:
> I currently have the following two lines in my crontab to delete old
> mails in my junk catching directories

May I ask why? I mean, how many tens of GB of mail do you get each year so that
it is necessary to delete stuff?

Matthias


signature.asc
Description: PGP signature