title: A Faster way of Directory walking instead of os.listdir?
body: <p>I am trying to improve performance of elfinder , an ajax based file manager(elRTE.ru) .</p>
  
  <p>It uses os.listdir in a recurisve to walk through all directories recursively and having a performance hit (like listing a dir with 3000 + files takes 7 seconds ) ..</p>
  
  <p>I am trying to improve performance for it here is it's walking function:</p>
  
  <pre><code>        for d in os.listdir(path):
              pd = os.path.join(path, d)
              if os.path.isdir(pd) and not os.path.islink(pd) and self.__isAccepted(d):
                  tree['dirs'].append(self.__tree(pd))
  </code></pre>
  
  <p>My questions are :</p>
  
  <ol>
  <li>If i change os.walk instead of os.listdir , would it improve performance?</li>
  <li>how about using dircache.listdir() ? cache WHOLE directory/subdir contents at the initial request and return cache results , if theres no new files uploaded or no changes in file?</li>
  <li>Is there any other method of Directory walking which is faster?</li>
  <li>Any Other Server Side file browser which is fast written in python (but i prefer to make this one fast)?</li>
  </ol>