title: How to make a recursion loop function in python to loop through folders
body: <pre><code>DIR_PATH = os.path.dirname(os.path.abspath(__file__))
  
  def loop_folder(folder_name):
  
  return 
  
  def get_file_details(path):
       for files in os.listdir(DIR_PATH): 
        listOfFiles = os.listdir('.')  
      for entry in listOfFiles:
          if entry != '.DS_Store':
              if os.path.isdir(entry):
                    loop_folder()
              elif entry.endswith(".csv"):
                  print entry
  </code></pre>
  
  <p>Hello, 
  I want to write a script that loops in a folder and it's sub-folders until it finds a file with .csv and print it. </p>
  
  <p>I want to make a recursion loop function and call it. But I am stuck and I could use some guidance 
  My problem is with the loop function </p>