[CentOS] Computer 1A question

Todd Cary todd at aristesoftware.com
Sat Aug 5 14:48:48 UTC 2006


This one worked like a champ:

find /home/mydir -name "*.zip" -type f -exec rm {} \;

Whereas this one produced an error:

find /home/mydir -name "*.zip" -type f -print0 | xargs -0 rm

Many thanks!

Todd

Joshua Baker-LePain wrote:
> On Fri, 4 Aug 2006 at 5:17pm, Hugh E Cruickshank wrote
>
>> From: Seán O Sullivan Sent: August 4, 2006 17:10
>>>
>>> Todd Cary wrote:
>>>> I want to delete all files that have the pattern of "*.zip" in the
>>>> directory /home/mydir and all sub-directories.
>>> find /home/mydir -name "*.zip" -type f -print0 | xargs -0 rm
>>>
>>
>> Or: find /home/mydir -name "*.zip" -type f -exec rm {} \;
>
> To complete the discussion, the first form should be faster, as it 
> will only spawn 1 rm command rather than one for every result of 
> 'find'.  This can make a big difference if a lot of results are expected.
>
> ------------------------------------------------------------------------
>
> _______________________________________________
> CentOS mailing list
> CentOS at centos.org
> http://lists.centos.org/mailman/listinfo/centos
>   

-- 
Ariste Software
2200 D Street Ext
Petaluma, CA 94952
(707) 773-4523

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.centos.org/pipermail/centos/attachments/20060805/f4f13bfb/attachment.html>


More information about the CentOS mailing list