title: How do I upload full directory on FTP in python?
body: <p>Ok, so I have to upload a directory, with subdirectories and files inside, on a FTP server. But I can't seem to get it right. I want to upload the directory as it is, with it's subdirectories and files where they were.</p>
  
  <pre><code>ftp = FTP()
  ftp.connect('host',port)
  ftp.login('user','pass')
  filenameCV = "directorypath"
  
  def placeFiles():
  
   for root,dirnames,filenames in os.walk(filenameCV):
      for files in filenames:
          print(files)
          ftp.storbinary('STOR ' + files, open(files,'rb'))
          ftp.quit()
  
  placeFiles()
  </code></pre>