'rm' Can not delete files

Matthew Seaman m.seaman at infracaninophile.co.uk
Fri Feb 10 16:25:02 UTC 2012


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: matthew at infracaninophile.co.uk               Kent, CT11 9PW

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 267 bytes
Desc: OpenPGP digital signature
Url : http://lists.freebsd.org/pipermail/freebsd-questions/attachments/20120210/0637654c/signature.pgp


More information about the freebsd-questions mailing list