In article C31ED75A-0115-44FC-940D-C2956C46EA05@sbcglobal.net, Kevin Krieser k_krieser@sbcglobal.net wrote:
On Jan 23, 2010, at 6:45 AM, Robert P. J. Day wrote:
On Sat, 23 Jan 2010, Marcelo M. Garcia wrote: the find ... -exec variation will invoke a new "rm" command for every single file it finds, which will simply take more time to run. beyond that, the effect should be the same.
Unless there are files or directories with spaces in them, in which case the xargs variant can fail.
That's what -print0 is for, together with the -0 option to xargs:
find dir1 dir2 -name '*.foo' -print0 | xargs -0 rm
Cheers Tony