我怎样才能排除所有"许可被拒绝"从&QUOT消息;发现"? [英] How can I exclude all "permission denied" messages from "find"?

查看:200
本文介绍了我怎样才能排除所有"许可被拒绝"从&QUOT消息;发现"?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我要隐藏所有的权限被拒绝的信息来自:

I need to hide all permission denied messages from:

find . > files_and_folders

当这样的消息出现

我的实验。我需要收集的所有文件夹和文件,以它并不存在。

I am experimenting when such message arises. I need to gather all folders and files, to which it does not arise.

是否有可能直接权限级别的 files_and_folders 文件?

Is it possible to direct the permission levels to the files_and_folders file?

我怎么能在同一时间隐藏的错误?

How can I hide the errors at the same time?

推荐答案

使用:

find . ! -readable -prune


  • 要避免出现权限被拒绝

  • ,不燮preSS(其他)的错误信息

  • 并获得退出状态0(所有文件都成功处理)

  • 与使用:发现(GNU的findutils)4.4.2。
    背景:

    Works with: find (GNU findutils) 4.4.2. Background:


    • 可读测试匹配可读的文件。在运算符返回true,当测试为假。和!可读匹配不可读目录(安培;文件)。

    • -prune 动作不沦落成目录。

    • !可读-prune 可以转化为:如果目录不读,不沦落成它

    • 可读测试考虑到了访问控制列表以及其中 -perm 测试忽略了其他权限文物。

    • The -readable test matches readable files. The ! operator returns true, when test is false. And ! -readable matches not readable directories (&files).
    • The -prune action does not descend into directory.
    • ! -readable -prune can be translated to: if directory is not readable, do not descend into it.
    • The -readable test takes into account access control lists and other permissions artefacts which the -perm test ignores.

    另请参见发现(1)联机帮助更多的细节。

    See also find(1) manpage for many more details.

    有关查找版本,没有可读的测试,您可以检查权限:

    For find versions without -readable test, you can check permissions:

    find . ! -perm -g+r,u+r,o+r -prune
    

    请参见 sadaus回答

    这篇关于我怎样才能排除所有"许可被拒绝"从&QUOT消息;发现"?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆