linux - 嵌套最深的可写文件夹?

标签 linux

大家好,我需要找到嵌套最深的可写文件夹:

我写了这个命令:find。 -type d -printf '%d:%p\n' |排序-n |尾部-1

但是如何添加条件“此文件夹是否可写”?

最佳答案

尝试这样做:

find . -type d -writable -printf '%d:%p\n' | sort -n | tail -1

man find 说:

-writable

Matches files which are writable. This takes into account access control lists and other permissions artefacts which the -perm test ignores. This test makes use of the access(2) system call, and so can be fooled by NFS servers which do UID mapping (or root-squashing), since many systems implement access(2) in the client's kernel and so cannot make use of the UID mapping information held on the server.

这也适用于 dirs。

关于linux - 嵌套最深的可写文件夹?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14448704/

相关文章:

django - pip 找不到满足要求的版本 django==2.2.1

linux - 全新安装时安装 vim 插件 vundle 失败

linux - 正确的 zsh shell 命令转义

linux - BASH 中文本文件中的多个变量

c++ - 向某些屏幕位置写入宽字符时,ncurses 会崩溃

linux - 更改文件名并复制到不同的目录

c++ - 在 Linux 上使用 CMake 构建 gRPC C++

linux - 使用模式文件进行反向 grep 搜索?

linux - X11:以另一个用户身份运行 gnome 应用程序

linux - 使用 AWK 打印除第一列之外的所有列