我使用 Linux 系统,有一个目录包含许多子目录和其中的项目。我想对所有目录和子目录进行递归 chmod 操作,但不包括这些目录中的任何文件。
chmod -R 777 {folder}
有没有可以添加到chmod命令中的标志,使chmod仅适用于子目录?
我能想到的是:
find {folder} -type d -print0 | xargs -0 chmod 777
chmod -R u=rwX,go=rwX {folder}
希望对您有所帮助!尝试:
在 {folder} 中查找类型为目录的文件,执行命令:chmod 777 {} \;
sudo chmod 777 -v $(find $PWD -type d)
chmod: missing operand after '777'
但是:find {folder} -type d -print0 -exec chmod 777 {} \;
对我来说是按预期工作的。 - undefined