Tricky Deleting
Charles Curley
charlescurley at charlescurley.com
Wed Mar 9 06:35:51 MST 2005
On Tue, Mar 08, 2005 at 08:51:06PM -0700, Nicholas Leippe wrote:
> On Tuesday 08 March 2005 07:34 pm, Doran Barton wrote:
> > So what about 'find stuff -exec rm {} \;'?
>
> Should work. Performance-wise, I believe find exec()'s an rm for each item it
> finds, so similar to xargs. It should, however, save at least one invocation
> of the shell.
The -exec invokes a shell and rm for each file found.
Piping through xargs, as we were doing earlier, invokes a shell for
xargs, and a shell and rm for each time rm is invoked. Since rm is
invoked with multiple arguments (try it with '| xargs echo' to see
what it does), it is invoked fewer times, so should be much more
efficient.
The number of times rm is invoked is a function of the maximum command
line length divided by the typical file path length. Researching the
maximum command line length will be left as an exercise for the
student.
--
Charles Curley /"\ ASCII Ribbon Campaign
Looking for fine software \ / Respect for open standards
and/or writing? X No HTML/RTF in email
http://www.charlescurley.com / \ No M$ Word docs in email
Key fingerprint = CE5C 6645 A45A 64E4 94C0 809C FFF6 4C48 4ECD DFDB
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
Url : http://plug.org/pipermail/plug/attachments/20050309/74db28a5/attachment.bin
More information about the PLUG
mailing list