title: python return empty list from function
body: <p>I am sorry to ask such a basic question but I am trying to learn python and don't understand why this does not work. When I run this program on a directory it prints and empty list []. I don't understand why. Can someone help? Python 3.</p>
  
  <pre><code>import sys, os, 
  
  
  
  def getfiles(currdir):
      myfiles = []
      for file in os.listdir(currdir):
           for file in os.listdir(currdir):
              path = os.path.join(currdir,file)
              if not os.path.isdir(path):
                  myfiles.append(path)
              else:
                  getfiles(path)
      return(myfiles)
  
  
  
  
  if __name__ == '__main__':
      filedirectory = []
      filedirectory = getfiles(sys.argv[1])
      print(filedirectory)
  </code></pre>
  
  <p>This returns []</p>
  
  <p>Thank you for the help</p>