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

Kyle Wheeler kyle-dovecot at memoryhole.net
Thu Jun 12 22:27:28 EEST 2008


On Thursday, June 12 at 01:02 PM, quoth Jeff Kowalczyk:
> On Thu, 12 Jun 2008 10:19:48 -0500, Kyle Wheeler wrote:
>> 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
>
> Thanks, I'm going to do that. And per dmeissler, I'm going to consider 
> xargs.

<shrug> xargs is good for other things, but if all you're doing is 
deleting files, find can do it itself without involving other 
applications. But whatever makes you comfortable.

> Any thoughts on a variant using find -name that could safely iterate 
> over /home/*/Maildir for all users? Otherwise I would script it in 
> python.

find /home/ -path '*/Maildir/.Junk/cur/*' -type f -delete

~Kyle
-- 
Nothing makes a woman more beautiful than the belief she is beautiful.
                                                        -- Sophia Loren
-------------- 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/ca0898ea/attachment.bin 


More information about the dovecot mailing list