开发者

chmod: How to recursively add execute permissions only to files which already have execute permission [closed]

开发者 https://www.devze.com 2023-03-24 23:35 出处:网络
Closed. This question is off-topic. It is not currently accepting answers. 开发者_开发百科 Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed. This question is off-topic. It is not currently accepting answers.
开发者_开发百科

Want to improve this question? Update the question so it's on-topic for Stack Overflow.

Closed 11 years ago.

Improve this question

I noticed:

chmod -R a+x adds execute permissions to all files, not just those who are currently executable.

Is there a way to add execute permissions only to those files who already have an execute set for the user permission?


Use find:

find . -perm /u+x -execdir chmod a+x {} \;


You can use find to get all those files:

find . -type f -perm -o+rx -print0 | xargs -0 chmod a+x

Update: add -print0 to preserve space in filenames

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号