[CentOS] The directory that I am trying to clean up is huge
Tony Mountifield
tony at softins.clara.co.uk
Mon Jan 25 11:00:01 UTC 2010
In article <C31ED75A-0115-44FC-940D-C2956C46EA05 at sbcglobal.net>,
Kevin Krieser <k_krieser at 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
--
Tony Mountifield
Work: tony at softins.co.uk - http://www.softins.co.uk
Play: tony at mountifield.org - http://tony.mountifield.org
More information about the CentOS
mailing list