/ Published in: Bash

-print0 and -0 are used to allow for spaces and other wacky chars in directory names
Expand |
Embed | Plain Text
find . -type d -print0 | xargs -0 chmod 755
Comments

You need to login to post a comment.
jfine on 10/14/10
directory chmod find xargs directories 755
1 person have marked this snippet as a favorite
-print0 and -0 are used to allow for spaces and other wacky chars in directory names
find . -type d -print0 | xargs -0 chmod 755
You need to login to post a comment.
Shorter, faster method (note the capital X): chmod -R a+rX . This makes all files 644, and all directories and executables 755.
find . -type d -exec chmod 755 '{}' \;
That would work unless there are some really wacky filenames. That's the main reason I'm using the -print0 pattern.
See this URL for more info: http://www.gnu.org/software/findutils/manual/htmlnode/findhtml/Problems-with-_002dexec-and-filenames.html