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

Alexander Dalloz ad+lists at uni-x.org
Sat Jan 23 13:20:08 UTC 2010


Am 23.01.2010 14:12, schrieb Kevin Krieser:
> 
> 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.

find on CentOS 5.4 supports

find <path> -exec {} +;

which avoids the negative effect of spawning new subprocesses when using
"-exec {} \;"

find on CentOS 4.8 does not support that.

> 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.

Alexander



More information about the CentOS mailing list