title: Python code to print directories recursively
body: <p>I have the following code , but it traverses the 1st directory it finds and stops.
  I feel i have the recursive function which should have given the other directories too.
  Can anyone please point out what is wrong with this code.</p>
  
  <pre><code>def func(path,no):
      no=no+2
      for item in os.listdir(path):
          if os.path.isfile(path+"\\"+item):
              print no * "-" + " " + item
          if os.path.isdir(path+"\\"+item):
              path=path + "\\" + item
              print no * "-" + " " + item
              func(path,no)
  
  
  path="D:\\Hello"
  no=0
  func(pah,no)
  </code></pre>
  
  <p>OUTPUT : </p>
  
  <pre><code>-- 1.txt
  -- 2.txt
  -- 3.txt
  -- blue
  ---- 33.txt
  ---- 45.txt
  ---- 56.txt
  ---- Tere
  </code></pre>
  
  <p>"blue" &amp; "tere" are the directories. There are more directories int the "HELLO" folder which is not printed.</p>