Often one needs to chmod files or directories only. If you use chmod -R, changes will apply to both of them. If this is not what you want, you can use the code below.
It will recursively search your directory tree, starting at the current directory (that’s what the dot is for) and chmod 755 all directories only:
find . -type d -exec chmod 755 {} \;
Similarly, the following will chmod all files only and ignore the directories:find . -type f -exec chmod 644 {} \;
All explanation can be found in man find. The {} gets replaced by the current file, find is processing (which is why you don’t need to use chmod -R), and \; is just there to mark the end of the exec expression.