gpt4 book ai didi

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

转载 作者:塔克拉玛干 更新时间:2023-11-03 01:05:10 26 4
gpt4 key购买 nike

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

我写了这个命令: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/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com