Find the answer to your Linux question:
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 ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Just Joined!
    Join Date
    Oct 2006
    Posts
    26

    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?

  2. #2
    Trusted Penguin
    Join Date
    May 2011
    Posts
    4,353
    have u tried chmod -R?

  3. #3
    Just Joined!
    Join Date
    Oct 2006
    Posts
    26
    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:
    Code:
    find . -type d -exec chmod ug+x {} +
    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.

  4. $spacer_open
    $spacer_close
  5. #4
    Trusted Penguin
    Join Date
    May 2011
    Posts
    4,353
    what about just calling one chmod on the output of the find command? e.g.:
    Code:
    chmod +x `find . -type d whatever`
    does that do what u want? I've never used the '+' with find before...

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •