Re: The directory that I am trying to clean up is huge

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]



In article <C31ED75A-0115-44FC-940D-C2956C46EA05@xxxxxxxxxxxxx>,
Kevin Krieser <k_krieser@xxxxxxxxxxxxx> 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@xxxxxxxxxxxxx - http://www.softins.co.uk
Play: tony@xxxxxxxxxxxxxxx - http://tony.mountifield.org
_______________________________________________
CentOS mailing list
CentOS@xxxxxxxxxx
http://lists.centos.org/mailman/listinfo/centos

[Index of Archives]     [CentOS]     [CentOS Announce]     [CentOS Development]     [CentOS ARM Devel]     [CentOS Docs]     [CentOS Virtualization]     [Carrier Grade Linux]     [Linux Media]     [Asterisk]     [DCCP]     [Netdev]     [Xorg]     [Linux USB]
  Powered by Linux