I understand that chmod -R u=rwX,g=rwX,o=r
will set directory, subdirectories and files with the caveat:
The capital
X
permission option tells chmod to grant execute access only if it makes sense -- if the item is a directory, or already has at least one execute access enabled (i.e. if it appears to be an executable file).
But is there a way to force chmod
(in a similar fashion) to only affect directories, leaving all files as-is?
— Source