On Tue, 17 Oct 2006, Richard Laager wrote:
On Tue, 2006-10-17 at 13:25 -0500, Logan Shaw wrote:
On Tue, 17 Oct 2006, Noel Jones wrote:
On 10/17/06, Geert Hendrickx ghen@telenet.be wrote:
On *BSD you can also use find -X which properly quotes the results.
Nope, find -X skips files with strange characters. find -print0 | xargs -0 is the proper solution. $ man find
find . -type f -name '*whatever*' -exec rm '{}' '+'
Yes, but as already mentioned, this has the bad side effect of fork()ing one rm process per file, which is really inefficient.
I may not have highlighted the "+" clearly enough. It behaves differently than ";" does.
What I was saying is that if you are going to use a non-portable find feature (like "-print0"), Solaris 10 allows you to give "+" instead of ";" at the end. Then, as the Solaris 10 manual page says,
If the last argument to -exec is {} and you specify +
rather than the semicolon (;), the command is invoked
fewer times, with {} replaced by groups of pathnames.
So that is just as clean as the inefficient way, and more efficient than the "-print0 | xargs -0" way.
- Logan