<<< Date Index >>>     <<< Thread Index >>>

Re: wish: file/directory funtions for maildir etc (was: Re: New IMAP function: rename-mailbox)



Christoph Berg <cb@xxxxxxxx> wrote:
> Re: Tamotsu Takahashi in <20050222133145.GM14345@xxxxxxxxxxxxxxxxxxxxxxxxxx>
> > safely delete?:   !ls %s/cur/* %s/new/* || rm -r %s
> 
> If you want to delete only empty maildirs, the following is much
> better:
> 
> rmdir %s/cur %s/tmp %s/new %s

That still has the problem that it can leave an invalid maildir behind;
consider the case of a maildir with no new messages in it, for example.

The only truly safe way to do this is to stop any processes which could
deliver mail to the maildir in question, then do something like:

  [ ! -f %s/cur/* -a ! -f %s/tmp/* -a ! -f %s/new/* ] && rm -rf %s

Charles
-- 
-----------------------------------------------------------------------
Charles Cazabon                          <muttdev@xxxxxxxxxxxxxxxxxxxx>
-----------------------------------------------------------------------