NetBSD-Users archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: Find all files with at least one execute bit set





On Fri, 15 Aug 2025 at 04:57, RVP <rvp%sdf.org@localhost> wrote:
On Fri, 15 Aug 2025, Štěpán Němec wrote:

>> If not sticking to pure find(1):
>>
>> Compact, but slow, and filenames cannot contain (')--single quotes.
>>
>> $ find /dir/ -type f -exec sh -c "test -x '{}' && echo '{}'" \;
>>
>> Slightly faster, and should handle weird filenames:
>>
>> $ find /dir/ -type f -exec sh -c 'for f; do test -x "$f" && echo "$f"; done' xxx {} +
>
> This is behaviorally different from OP's command in that
> test -x tests for executability by the process running it,
> not for "at least one execute bit set".
>

Thanks. A distinction I missed: of course there can exist files executable by
others, but not by you.

Just a thought: 

find /dir/ -type f -ls | awk '$3 ~ /x/ { print $NF }'

 


Home | Main Index | Thread Index | Old Index