On Tue, Aug 29, 2000 at 09:58:23AM +1100, Russell Davies wrote:
> ; >cd $dir && echo * | xargs -n 400 rm -f
> ; 
> ; And just as well, echo * would have run into the same arglist
> ; limitations. ls | xargs rm would be better.
> ; 
> quite.. without the performance hit of forking and running rm _for every
> file_ *ouch!*
> 
> As an aside, I'd like to comment on the 'find . -print0 | xargs -0 rm'
> line that Andrew posted, this is precisely the sort of GNU specific
> extension that I would recommend that you DON'T learn, the moment you
> move to a Unix platform that doesn't have GNU find (and you will)
> you'll be puzzled. If you do, do so with the knowledge that this is NOT
> supported by traditional find (as found in the 7th Edition Unix Programmer's
> manual).

That's because traditional find is _broken_ in that regard,
because space (and the other shell word delimiters) are all
legitimate file name characters, and using "traditional" find,
or at least leaving out -print0, will almost certainly break on
many file hierarchies.

If you find yourself on a system that doesn't have a modern
enough find or xargs, then go ahead and compile them.  The whole
point of open-source software is that it raises the standard.

It's always pissed me off that many of the commercial vendors
have such crap utililties.

FWIW, the -0 argument to xargs is part of the POSIX standard,
and -print0 is supported by the BSD find implementations as well
as the GNU ones.

-- 
Andrew


--
SLUG - Sydney Linux User Group Mailing List - http://slug.org.au/
More Info: http://slug.org.au/lists/listinfo/slug

Reply via email to