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!

October 26th, 2006 at 7:35 pm
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
December 5th, 2006 at 12:33 pm
The “-R” isn’t mentioned on linox.be
February 21st, 2007 at 1:06 pm
The option -R is useless… cause you already have all the directories when you use “find -type d”. =)