How to recursively set the file permissions for all .php files on a *nix box
I had a need today to change the security of all .php files in a sub-directory, which contained dozens of sub-directories.
I figured out how to do it recursively with the find command. In the example below, I set all *.php files to chmod 755.
All other files with a file extension other than .php and directories were unaffected.
$ cd /mydirectory $ find . -type f -name '*.php' -exec chmod 755 {} \;