Wednesday, February 24, 2010

Recursively change permissions of directories only

There was once I accidentally recursively changed permissions of a directory to 777. This meant that all my files in that directory became executable.

Changing it back to 666 recursively meant that all my directories are no longer executable.

using the -type and -exec options in find, we are able to find directories and change permissions for them only.

find Pathname/ -type d -exec chmod 777 {} \;

No comments:

Post a Comment