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

孤人 提交于 2019-12-20 10:30:23

问题


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?


回答1:


Use find:

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



回答2:


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



来源:https://stackoverflow.com/questions/6937885/chmod-how-to-recursively-add-execute-permissions-only-to-files-which-already-ha

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!