Problem

You want to recursively change all of the file permissions only on folders & subfolders in a directory, but not the files (or vice-versa: you want to change the permissions on files only, not folders).

Solution

This command will recursively search your current directory and chmod all directories & sub-directories only:

cd /yourdirectory

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

The following command will chmod all files only (ignoring the directories):

cd /yourdirectory

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

Solution Credit: MovableTripe

About these ads