[K12OSN] OT: Scripting Question

Nils Breunese nils at breun.nl
Thu Nov 30 18:52:41 UTC 2006


Dan Young wrote:

> Nils Breunese wrote:
>> Dan Young wrote:
>>
>>>>> find /FOLDERNAME -type f -mtime +30 -exec rm -f {} ';'
>>>>
>>>> Fun trivia: xargs is faster than -exec'ing on every file. It  
>>>> will delete
>>>> the files together with one invocation of "rm" (or in optimally  
>>>> sized
>>>> chunks if you're deleting _lots_ of files):
>>>>
>>>> find /FOLDERNAME -type -f -mtime +30 -print0 | xargs -0 rm -f
>>>
>>> Oops:
>>>
>>> find /FOLDERNAME -type f -mtime +30 -print0 | xargs -0 rm -f
>>
>> I don't see the difference. Is it me?
>
> A misplaced hyphen:
> '-type -f' vs. '-type f'

I think I may have looked at it five times, but I really didn't see  
it. I was about to run md5sum on those commands... :o)

Nils.




More information about the K12OSN mailing list