On 10/02/2012 16:04, Matthew Story wrote: > find . -type f -depth 1 -print0 | xargs -n99 -0 -s8192 -c5 rm -- > > or some such, depending on your needs, I believe in most situations this > particular invocation will also out-perform find ... -delete.
Why would you believe that? find ... -delete calls unlink(2) directly on each file it finds as it searches the directory tree given that it matches the other find predicates. Whereas find ... -print0 | xargs ... rm ... involves a whole complicated sequence of find doing the same searching and matching job, then marshalling lists of filenames, piping them between processes, then xargs exec(2)ing rm with chunks of that arglist; each rm invocation then finally ... calling unlink(2) on each of the named files. Actually, I doubt you'ld see much difference above the noise in the speed of either of those two commands: they're both going to spend the vast majority of the time waiting for disk IO, and that's common to any way of doing this job. Cheers, Matthew -- Dr Matthew J Seaman MA, D.Phil. 7 Priory Courtyard Flat 3 PGP: http://www.infracaninophile.co.uk/pgpkey Ramsgate JID: matt...@infracaninophile.co.uk Kent, CT11 9PW
signature.asc
Description: OpenPGP digital signature