Re: Reliable/safe way of removing empty maildirs?
On Sun, Dec 09, 2007 at 08:41:07PM +0000, Chris G wrote:
> On Sun, Dec 09, 2007 at 05:59:40PM +0100, Louis-David Mitterrand wrote:
> > On Thu, Dec 06, 2007 at 01:03:13PM +0000, Chris G wrote:
> > > What's a reliable way of removing empty maildirs?
> >
> > my /etc/crontab entry:
> >
> > for i in ~/Maildir/.*; do if [ -d "$i" ] && [ ! "$(find "$i" -mindepth 2
> > -type f)" ]; then rm -rf "$i" ; fi ; done
>
> Which is OK until some mail arrives between the find and the rm
> surely?!
No, it is still OK:
1) if any maildir is missing the mda (procmail) will instantly recreate them
2) one should only prune empty maildirs for low-priority list/bulk mail