[CentOS] The directory that I am trying to clean up is huge

Kevin Krieser k_krieser at sbcglobal.net
Sat Jan 23 13:12:26 UTC 2010


On Jan 23, 2010, at 6:45 AM, Robert P. J. Day wrote:

> On Sat, 23 Jan 2010, Marcelo M. Garcia wrote:
> 
>> Robert Heller wrote:
>>>> 
>>>> -bash: /usr/bin/find: Argument list too long
>>> 
>>> 'man xargs'
>>> 
>>> find <mumble> -print | xargs rm
>>> 
>> Hi
>> 
>> Just curious. What is the difference between the command above and "find
>> <numble> -exec rm -f {} \;" ?
> 
>  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.

It is likely the original poster either did
find * ...
or find . -name *
and the bash shell still expanded the arguments.  He was on the right track using the find command, but it wasn't used right.


More information about the CentOS mailing list