Changing only directory permissions on UNIX recursively

One of those technical buggers that I couldn’t figure out, is how to make your command prompt run through a directory and change the permissions (chmod) for only directories in it. Then, just to top it off, do it recursively:

find /dir/to/chmod/all/dirs -type d -exec chmod -R 755 {} \;

That helps us, hope it helps others!  Many thanks to linox.be for the tip!

3 Responses to “Changing only directory permissions on UNIX recursively”

  1. ben Says:

    It seems that this grabs ALL files as well. I got it to work by removing the -R option from chmod. I’m assuming this is because the find -type d command is grabbing all dirs (well, it spits out all the dirs when I run find /path -type d).

    Thanks. Neat trick.

    Ben

  2. Fred Says:

    The “-R” isn’t mentioned on linox.be ;)

  3. ARVasko Says:

    The option -R is useless… cause you already have all the directories when you use “find -type d”. =)

Leave a Reply

You must be logged in to post a comment.