Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 10 Feb 2012 16:24:58 +0000
From:      Matthew Seaman <m.seaman@infracaninophile.co.uk>
To:        freebsd-questions@freebsd.org
Subject:   Re: 'rm' Can not delete files
Message-ID:  <4F3544DA.8010003@infracaninophile.co.uk>
In-Reply-To: <CAB%2B9ogewck4LU9wPtE4hWtT03ZoRBhYz3p-43WHkMcLoiX3Ahg@mail.gmail.com>
References:  <1237723287.20120207235924@yandex.ru> <4F31A260.20109@infracaninophile.co.uk> <20120207231716.31aa8bc3@gumby.homeunix.com> <20120209032544.GA58560@ozzmosis.com> <CAE7N2kdmbm_5=c8oNknYQE5HOrvVjtfS4XTGYvxTjEQVbGr-7Q@mail.gmail.com> <4F353D1F.3020100@herveybayaustralia.com.au> <CAB%2B9ogewck4LU9wPtE4hWtT03ZoRBhYz3p-43WHkMcLoiX3Ahg@mail.gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help
This is an OpenPGP/MIME signed message (RFC 2440 and 3156)
--------------enig8F6ED172D39762DBCAF4EDEE
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable

On 10/02/2012 16:04, Matthew Story wrote:
> find . -type f -depth 1 -print0 | xargs -n99 -0 -s8192 -c5 rm --
>=20
> or some such, depending on your needs, I believe in most situations thi=
s
> 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

--=20
Dr Matthew J Seaman MA, D.Phil.                   7 Priory Courtyard
                                                  Flat 3
PGP: http://www.infracaninophile.co.uk/pgpkey     Ramsgate
JID: matthew@infracaninophile.co.uk               Kent, CT11 9PW


--------------enig8F6ED172D39762DBCAF4EDEE
Content-Type: application/pgp-signature; name="signature.asc"
Content-Description: OpenPGP digital signature
Content-Disposition: attachment; filename="signature.asc"

-----BEGIN PGP SIGNATURE-----
Version: GnuPG/MacGPG2 v2.0.16 (Darwin)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAk81RNoACgkQ8Mjk52CukIzgZwCZAfQazm4OMKaqPhUuxycQ1r6w
JJIAoIaoMdVVUjvuidjcZfb4zlmGOz4P
=4Mk2
-----END PGP SIGNATURE-----

--------------enig8F6ED172D39762DBCAF4EDEE--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?4F3544DA.8010003>