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

Clinton picture Clinton · Aug 4, 2011 · Viewed 25.2k times · Source

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?

Answer

Oliver Charlesworth picture Oliver Charlesworth · Aug 4, 2011

Use find:

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