Posted By

jfine on 10/14/10


directory chmod find xargs directories 755

Versions (?)

Who likes this?

1 person have marked this snippet as a favorite


Chmod directories recursively to 755

 / Published in: Bash

-print0 and -0 are used to allow for spaces and other wacky chars in directory names

  1. find . -type d -print0 | xargs -0 chmod 755

Report this snippet  


RSS Icon Subscribe to comments
Posted By: pfudd on October 14, 2010

Shorter, faster method (note the capital X): chmod -R a+rX . This makes all files 644, and all directories and executables 755.

Posted By: laforge on October 14, 2010

find . -type d -exec chmod 755 '{}' \;

Posted By: jfine on May 24, 2012

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:

Posted By: jfine on May 24, 2012

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

You need to login to post a comment.