/ 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
Subscribe to comments
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
xargs is also much faster.
Here are a couple other interesting links for those who care to dig deeper.
Linux: xargs vs. exec {}
find -exec cmd {} + vs | xargs