I have to change the permissions of the htdocs
directory in apache to a certain group and with certain read/write/execute.
The directories need to have 775 permissions and the files need to have 664.
If I do a recursive 664 to the htdocs
, then all files and directories will change to 664.
I don't want to change the directories manually.
Is there any way to change only files or directories?
Use find's -type
option to limit actions to files and directories. Use the -o
option to specify alternate actions for different types, so you only have to run find
once, rather than separately for each type.
find htdocs -type f -exec chmod 664 {} + -o -type d -exec chmod 775 {} +