Paul Osborne - Java/PHP Developer

How to do a recursive chmod all PHP files in a site or folder

If you want to do a recursive chmod on a set of files below a given directory or folder using the bash shell you can do the following:

find . -type f -name ‘*.php’ -exec chmod 644 {} \;

This command can be easily adapted to work for other file types or modes. The ‘.’ following ‘find’ specifies the root directory for the operation.

How to chmod all folder/directories below the current directory…

find . -type d -exec chmod 755 {} \;

Alternatively, chmod on all directories below a given directory (./somedir)

find ./somedir -type d -exec chmod 755 {} \;

Post a Comment

Your email is never shared. Required fields are marked *

*
*