Can anyone point me to either code or a tutorial for writing a shell script that can recursively go through an entire directory structure (starting at the current working directory, or given an required argument of where to start at) and can:Determine whether an item is a directory, and if it is, chmod 755 it, or...Determine whether an item is a file (not a dir), and chmod 644 it.I'm looking for compatibility with Ubuntu, Debian, RHEL-Based, etc., so I'm not tagging this with any particular language.  I'd like this in Bash, but if you have a ZSH script, that will work also.
Shell Script for going through a dir recursively and chmodding based on conditions of file type
bash;command line;shell script;zsh
I am used to this one-line command (will recurse starting in current working directory)find . -type d -exec chmod 0755 '{}' + -or -type f -exec chmod 0644 '{}' +Explanation:find .                    # starting in curdir find   -type d                   # any directory-exec chmod 0755 '{}'     # and chmod it to 755+                         # (variant of -exec look find man page)-or                       # or-type f                   # any file-exec chmod 0644 '{}'     # and chmod it to 644+                         # (as above)