title: Chmod recursively
body: <p>I have an archive, which is archived by someone else, and I want to automatically, after I download it, to change a branch of the file system within the extracted files to gain read access. (I can't change how archive is created).</p>
  
  <p>I've looked into this thread: <a href="https://stackoverflow.com/questions/6937885/chmod-how-to-recursively-add-execute-permissions-only-to-files-which-already-ha">chmod: How to recursively add execute permissions only to files which already have execute permission</a> as into some others, but no joy.</p>
  
  <p>The directories originally come with multiple but all wrong flags, they may appear as:</p>
  
  <pre><code>drwx------
  d---r-x---
  drwxrwxr-x
  dr--r-xr--
  </code></pre>
  
  <p>Those are just the few I've discovered so far, but could be more.</p>
  
  <p><code>find</code> errors when tries to look into a directory with no <code>x</code> permission, and so doesn't pass it to <code>chmod</code>. What I've been doing so far, is manually change permissions on the parent directory, then go into the child directories and do the same for them and so on. But this is a lot of hand labour. Isn't there some way to do this automatically?</p>
  
  <p>I.e. how I am doing it now:</p>
  
  <p>do:</p>
  
  <pre><code>$ chmod -R +x
  $ chmod -R +r
  </code></pre>
  
  <p>until I get no errors, then</p>
  
  <pre><code>$ find -type f -exec chmod -x {} +
  </code></pre>
  
  <p>But there must be a better way.</p>