On Mon, Feb 13, 2006 at 06:32:53PM -0800, Ted Unangst wrote:
> > > find ./ -type f -print | xargs -i rm -f
> > > Instead of
> > > rm -f $(find ./ -type f -print)
> >
> > Because that will fail when there are too many arguments, and will
> > probably break on filenames with spaces (use xargs -0 for these).
>
> with either version, hilarity is sure to ensue when you discover an
> accidentally created -r file. always use --.
And watch out for silly file names containing whitespace.
BTW: if this is a contest on creative use of find(1) and other
standard tools:
$ find . -type f | sed '[EMAIL PROTECTED]@grep -l -- foo @' | sh
Yes, this isn't robust against whitespace, either PLUS it's
inefficient. But in some cases the find ... | sed ... | sh pattern
is quite useful.
Ciao,
Kili