@Gillesがこの許可を指摘したいのは、アクセス許可について文句を言うパスを除外する -Unix &Linux Stack Exchange ; それは基本的に、find
読み取り不可能なディレクトリを下回らないようにするための構造を含んでおり、その意味で、おそらく少し高速です。
これは私にとってはうまくいくようです:
GNU find
またはその他の述語と述語find
をサポートしている場合:-readable
-executable
find / -type d ! \( -readable -executable \) -prune -o -type f -name netcdf -print
またはこれも:
find / -type d ! -perm -g+r,u+r,o+r -prune -o -type f -name 'netcdf' -print
何らかの理由で、すべてを追加する必要がありますg+r,u+r,o+r
(そのショートカットはですa+r
)。そうしないと、そのうちの1つが除外された場合でも、「Permission Denied」ヒットが表示される場合があります。
これがどのように見えるかの内訳です(2つの述語の間の-a
(および)演算子find
が暗黙的であることに注意してください):
find / # find starting from path /
-type d # match type is directory
! -perm -a+r # (and) match not permissions of `r`ead present
-prune # ignore what matched above and do not descend into it
-o # or (whatever didn't match above)
-type f # match type is file
-name 'netcdf' # (and) match name is 'netcdf'
-print # print what matched above
最後のなしでは-print
、いくつかの余分な項目が表示されることに注意してください(これはに関係ありません-name 'netcdf'
)。これ-print
により、一致する名前のみが出力されます(存在する場合)。