[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: keep find from trying to spider directories where it has no permissi
From: |
Jim Meyering |
Subject: |
Re: keep find from trying to spider directories where it has no permission |
Date: |
Mon, 09 Nov 2009 10:28:34 +0100 |
James Youngman wrote:
> On Sat, Sep 19, 2009 at 4:41 PM, <address@hidden> wrote:
>> EB> Untested, but:
>> EB> -type d \! -readable -prune
>> EB> seems like it should do the trick of telling find to not descend into
>> EB> unreadable directories.
>>
>> Well, I hope there can be an example added to the find man page.
>>
>> Anyway, in the general case ... there needs to be a way...
>>
>> $ chmod 0 jidanni.org/geo/islands
>> $ find jidanni.org -type f|wc
>> find: `jidanni.org/geo/islands': Permission denied
>> 419 419 17983
>> $ find jidanni.org ! -readable -prune -type f|wc
>> 0 0 0
>>
>> Anyway, the challenge is to get the same output as
>> $ find jidanni.org -type f 2>&-|wc
>> 419 419 17983
>> without the 2>&- .
>
> ~/tmp$ find . \! -readable -prune , -type f | wc
> 2 2 36
> ~/tmp$ find . -type f | wc
> find: `./unr': Permission denied
> 2 2 36
Nice example. I had to look up the "," operator.