title: show all files under a dirctory
body: <pre><code>import os
  
  
  def findFiles(root_dir=&quot;C:/Users/15025/Desktop/books/&quot;, res=None):
      if not res:
          res = []
      for f in os.listdir(root_dir):
          f_path = os.path.join(root_dir, f)
          if os.path.isfile(f_path):
              res.append(f_path)
          elif os.path.isdir(f_path):
              findFiles(f_path, res)
      
      return res
  
  
  result = findFiles()
  print(result)
  </code></pre>
  <p>I find some problems here, if I have a file under <code>&quot;C:/Users/15025/Desktop/books/&quot;</code> directory, like <code>deepLearning</code>, and in this <code>deepLearning</code> file I have a document named <code>debug.py</code>. But when I run this program, the <code>print(result)</code>shows nothing, it is strange. Could someone tell me why? I think it is because the program will be called twice. But what is the reason in detail?</p>
  <p>The figure of my directory and the running result could seen below:
  <a href="https://i.stack.imgur.com/1pPpb.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/1pPpb.png" alt="my directory" /></a></p>
  <p><a href="https://i.stack.imgur.com/54N0z.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/54N0z.png" alt="running result" /></a></p>