chmod -R a+x
使用 find 方法:
find
find . -perm /u+x -execdir chmod a+x {} \;
-execdir
-exec
chmod
+
\;
... -exec chmod <mode> {} +
find . -type f -perm -o+rx -print0 | xargs -0 chmod a+x
更新:添加-print0以保留文件名中的空格。
-execdir
命令,它比-exec
更安全。另外,由于chmod
命令可以在单个命令行中接受多个文件,因此使用+
而不是\;
可能会有更好的性能表现。 - jw013+
模式!然而,使用-execdir
代替-exec
会再次压缩获得的性能优势;而且由于find命令已经提供了完整的文件路径,这是否很重要呢?对我来说最快的命令是... -exec chmod <mode> {} +
。 - codeling