Recursive chmod only on {directories|files}

I'd like to know how could I change the permissions of all my folders recursively under a path (e.g. /Users/me/Desktop/main_folder) and also change permissions to all my files under a specific folder.

These are the permissions I'd like to assign:

  • All folders: 700
  • All files: 600

There's a question for folders, but I didn't find one for the files.


That's

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

for all directories begining from . the current directory, and

find . -type f -exec chmod 600 {} \;

for the files.

Is there a way to know all the folders modified?

That would be

find . -type d -exec chmod 700 {} \; -exec echo {} \;

I have to cd to the root folder first right?

PLEASE DO NOT DO THIS FROM THE ROOT DIRECTORY: you will make all executables un-excutable, including ls, rm, mkdir, and so on. The system will become unmanageable!!!