I'd like to give execute permissions on a path recursively so I can read a file in the directory. The chmod binary that I'm using on Android only supports the octal/numeric notation though.

Normally I'd do chmod -R a+x /this/file/is/here/filename.txt but don't know how I'd do this numerically. I've Googled but haven't found an answer to this.

Looking at at the question "Is it possible to represent the +X symbolic permission with an octal value?", I don't think this is possible but what would the easiest recommended way.


You cannot do that using octal notation. Octal notation only allows you to set all mode bits and the +x allows to add to existing mode bits.

If you have find on the system, you can write a script that uses find to search for directories a specific combination of mode bits with -perm and change only those to the pattern including the execute bits.

@Wally's solution will not work because directories A and B:

-rwxrwxr-- A
-rwxr-xr-- B

will both become rwxr-xr-x with his solutions but with chmod a+x:

-rwxrwxr-x A
-rwxr-xr-x B

Permissions with chmod are as follows:

User (r-w-e)
User's primary group (r-w-e)
Everyone (r-w-e)

You probably want to give permissions as follows:

chmod 755

Which gives User: rwe, Group: re, Everyone: re

It's usually helpful to have the read-execute together, rather than just execute.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.