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

Attachment: pgpPPaHPPJn5R.pgp
Description: PGP signature

.===================================.
| This has been a P.L.U.G. mailing. |
|      Don't Fear the Penguin.      |
|  IRC: #utah at irc.freenode.net   |
`==================================='

Reply via email to