[plug] rm of contents

Craig Ringer craig at postnewspapers.com.au
Mon Mar 17 15:30:57 WST 2003


>>>On Sun, Mar 16, 2003 at 07:46:03PM +0800, Leon Brooks wrote:
>>>| > find dir -type f -print0 | xargs -0 rm
>>>|
>>>| find dir -type f -exec rm -f {} \;
> 
> [...]
> 
>>The first will fail if it finds lots of files, as the command line will be too 
>>long.
> 
> 
> But that is exactly the problem that xargs avoids!?!?!?!?!

Yeah, it is. You can specify a number of parameters to go with each 
invocation of the command passed to xargs, and I think it defaults to 
100. So it won't overrun the max command line length, when

	rm -f $(find dir -type f -print0 \;)

will.

Craig




More information about the plug mailing list