title: Faster alternative/usage of os.walk to only find all subdirs in Python
body: <p>From what I've read around the interwebs and here on SO, os.walk is one of the best bets for finding all subdirs and files in a directory, but the question I have is, if I <em>only</em> want to recursively find all the <strong>subdirectories</strong>, is os.walk the fastest solution?</p>
  
  <p>I suppose in addition my question is since the call to os.walk involves <code>for root, dirs, files in os.walk(path)</code>, does os.walk actually look at all the files if you don't necessarily call for it?</p>
  
  <p>Presently, my code is:</p>
  
  <pre><code>for root, dirs, files in os.walk(path):
      for x in dirs:
          DoStuffHere
  </code></pre>
  
  <p>But it sure seems slow on a folder with many many subdirs and files.</p>
  
  <p>Thanks.</p>