Best method to recursively chmod/process files or directories
8th June 2009
Found here.
Recursively set directories only to drwx-rx-rx (755):
find . -type d -exec chmod 755 {} \;
Recursively set files only to rwx-r-r (644):
find . -type f -exec chmod 644 {} \;
Recursively remove carriage returns (^M) from the end of all *.php files:
find . -type f -name “*.php” -exec /home/user/dos2unix.sh {} \;
In all these cases, {} is replaced with the filename/directory find has found matching your parameters; \; at the end just stops exec processing.