如何递归chmod名称中包含空格字符的目录

时间:2013-01-15 18:32:38

标签: linux command-line chmod

find . -type d | xargs chmod 770

不起作用,给出“没有这样的文件或目录”

2 个答案:

答案 0 :(得分:1)

如果您只想进行递归,请使用-R

chmod -R 770 dir_path

这就是你想要的:

find . -type d | xargs -I {} chmod -R 770 "{}"

答案 1 :(得分:1)

您想使用print0的{​​{1}}选项来处理文件名中的空格

find

为什么不使用find . -type d -print0 | xargs chmod 770 选项:

-R