Results 1 to 4 of 4
Often, I find myself needing to make a tree of directories executable for someone, ie:
find . -type d -exec chmod ug+x {} \;
But I don't like the overhead ...
- 08-29-2011 #1Just Joined!
- Join Date
- Oct 2006
- Posts
- 22
Ways to make only dirs executable WITOUT using find
Often, I find myself needing to make a tree of directories executable for someone, ie:
find . -type d -exec chmod ug+x {} \;
But I don't like the overhead of find, and running a "new"chmod for every dir.
You folks have preferred alternatives?
- 08-31-2011 #2Linux Guru
- Join Date
- May 2011
- Posts
- 1,838
have u tried chmod -R?
- 08-31-2011 #3Just Joined!
- Join Date
- Oct 2006
- Posts
- 22
chmod -R will make ALL files executable, I only want the x bit set in directories.
chmod -RX . is a better, but only if none of the regular files have any of thier x bits set. The best I have found is:
This variant of the -exec action runs the specified command on the selected files, but the command line is built by appending each selected file name at the end; the total number of invocations of the command will be much less than the number of matched files.Code:find . -type d -exec chmod ug+x {} +
- 08-31-2011 #4Linux Guru
- Join Date
- May 2011
- Posts
- 1,838
what about just calling one chmod on the output of the find command? e.g.:
does that do what u want? I've never used the '+' with find before...Code:chmod +x `find . -type d whatever`


Reply With Quote
