[Imap-uw] Truncating an email folder
MRC at CAC.Washington.EDU
Thu Sep 21 16:36:14 PDT 2006
On Thu, 21 Sep 2006, Erik Kangas wrote:
> I want to know the most efficient way to truncate and email folder (i.e.
> delete all messages but leave the folder in tact).
> * I could use "mailutil prune" for this
"mailutil prune" with search_criteria of "all" is not a bad choice. The
"all" search is trivial, and requires no work.
There is an issue in formats that allow sharing (tenex, mtx, and mbx) is
that the deleted flags in all the messages gets set first before
expunging. This will cause some I/O. It's also an issue in mix format,
but much less since it's just one rewrite of the status file.
> * I don't want to "delete" the folder and re-create it. As we will be using
> MIX soon, we may have folders in folders ... so deleting folders is no longer
> a good option unless they are known not to have children.
> Any better ideas than "mailutil prune"? Ideally one that would require
> minimal I/O (i.e. no need to search the messages if we will delete all).
Well, you could overwrite the mailbox with a known empty mailbox, but that
is only a solution for flat file formats (unix, mmdf, tenex, mtx, and
mbx). That may be helpful since the worst case is with tenex, mtx, and
Given that you're planning to use mix, I wouldn't worry about it and just
go with "mailutil prune ...mailbox... all".
-- Mark --
Science does not emerge from voting, party politics, or public debate.
Si vis pacem, para bellum.
More information about the Imap-uw