Christofer C. Bell wrote:
> cbell@circe:~/test$ time find rm -type f -exec rm {} \+
There isn't any need to escape the '+' character.
time find rm -type f -exec rm {} +
> It doesn't seem possible to run a similar test for unlink as it
> appears it only operates on 1 file at a time. So it does seem that rm
> with the find and/or xargs options you provided is the best way to go
> (at least for this test case).
I definitely recommend using -exec rm {} + over using xargs because
the find method has been incorporated into the POSIX standard. All
operating systems will have it. The xargs -0 method is a GNU
extension and won't be available portably.
Once you decide to use GNU extensions (such as xargs -0) then you
might as well use a different GNU extension and use -delete instead.
In for a penny, in for a pound. Using -delete is almost certainly the
fastest method since it doesn't spawn any external processes.
time find rm -type f -delete
Bob
Attachment:
signature.asc
Description: Digital signature