[Dovecot] Need a quick, safe method to empty /home/user/Maildir/{.Junk, .Trash}

Kyle Wheeler kyle-dovecot at memoryhole.net
Thu Jun 12 18:19:48 EEST 2008


On Thursday, June 12 at 11:10 AM, quoth Bill Cole:
>> What is the safest way to empty all messages within, but not 
>> delete, the
>> following folders from the server command line:
>>
>> /home/user/Maildir/.Junk
>> /home/user/Maildir/.Trash
>>
>> I don't want the Thunderbird-2.0.14 client to report corrupt
>> indexing, or worse not show the folder at next use.
>
> The way to do that in a shell (rather than via Dovecot) would be to 
> remove all of the current message files and all of Dovecot's indexing and 
> metadata caching:
>
>
> cd /home/user/Maildir/.Junk
> rm dovecot-index* cur/*
> cd /home/user/Maildir/.Trash
> rm dovecot-index* cur/*
>
> (restructure that as you like, I've written it that way to make the 
> operations clear)

If you have a *TON* of messages in those folders (i.e. several 
thousand), your shell may complain that there are too many arguments 
to the rm command. If that happens, these may be better commands to 
delete them:

find /home/user/Maildir/.Junk/cur -type f -delete
find /home/user/Maildir/.Trash/cur -type f -delete

... and then get rid of the index files as indicated above, of course.

~Kyle
-- 
Men, as an organization, are getting more women than any other group 
working anywhere in the world. Wherever women are, we have men looking 
into it.
                                                      -- Jerry Seinfeld
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 204 bytes
Desc: not available
Url : http://dovecot.org/pipermail/dovecot/attachments/20080612/f6f25343/attachment.bin 


More information about the dovecot mailing list