Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from ftplib import FTP
- from sqlalchemy import create_engine
- import os
- import sys
- import os.path
- ftp=FTP('host')
- ftp.login('user','pwd')
- for files in ftp.dir():
- filenames=ftp.nlst(files)
- ftp.retrbinary("RETR " + a, file.write)
- file.close()
- ftp.close() #CLOSE THE FTP CONNECTION
- print "FTP connection closed. Goodbye"
Add Comment
Please, Sign In to add comment