Guest User

Untitled

a guest
Jun 21st, 2018
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.33 KB | None | 0 0
  1. from ftplib import FTP
  2. from sqlalchemy import create_engine
  3. import os
  4. import sys
  5. import os.path
  6.  
  7.  
  8. ftp=FTP('host')
  9. ftp.login('user','pwd')
  10.  
  11. for files in ftp.dir():
  12. filenames=ftp.nlst(files)
  13. ftp.retrbinary("RETR " + a, file.write)
  14. file.close()
  15.  
  16.  
  17. ftp.close() #CLOSE THE FTP CONNECTION
  18. print "FTP connection closed. Goodbye"
Add Comment
Please, Sign In to add comment