[Dovecot] deleting maildir files

Gunter Ohrner G.Ohrner at post.rwth-aachen.de
Wed Jul 18 21:26:32 EEST 2007


Am Mittwoch, 18. Juli 2007 schrieb Kyle Wheeler:
> Another one I use often is:
>      find ./tmp ./cur -type f -exec rm {} \;

Current GNU finds understand the -delete action:

   find ./tmp ./cur -type f -delete

That should be as fast as the "ls" solution without getting you in trouble 
if a \r manages to get into one of the filenames somehow.

Another safe and fast solution would be

  find ./tmp ./cur -type f -print0 | xargs -0 rm

which should also work with older GNU finds. I do not know which one is 
better supported (if at all) in finds from other vendors.

In any case both should be much faster than spawning an "rm" for every 
file, although this solution should also be safe. I would not trust the 
piped "ls-output-solution" (given in the grandparent) on a production 
system, however.

Greetings,

  Gunter
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part.
Url : http://dovecot.org/pipermail/dovecot/attachments/20070718/3610e560/attachment.bin 


More information about the dovecot mailing list