title: traverse directory structure in python recursively without os.walk
body: <p>I am trying to write a python2 function that will recursively traverse through the whole directory structure of a given directory, and print out the results.</p>
  
  <p>All without using os.walk</p>
  
  <p>This is what I have got so far:</p>
  
  <pre><code>test_path = "/home/user/Developer/test"
  
  def scanning(sPath):
      output = os.path.join(sPath, 'output')
      if os.path.exists(output):
          with open(output) as file1:
              for line in file1:
                  if line.startswith('Final value:'):
                      print line
      else:
          for name in os.listdir(sPath):
              path = os.path.join(sPath, name)
              if os.path.isdir(path):
                  print "'", name, "'"
                  print_directory_contents(path)
  
  scanning(test_path)
  </code></pre>
  
  <p>This is what I currently get, the script doesn't enter the new folder:</p>
  
  <pre><code>' test2'
  'new_folder'
  </code></pre>
  
  <p>The issue is that it does not go further down than one directory.  I would also like to able to indicate visually what is a directory, and what is a file</p>