he*******@hotmail.com (Joe) wrote in message news:<56**************************@posting.google. com>...
How can you grab files over an ftp connection using ftplib? I can
make the connection, browse to the directory, view directory, but
can't copy over the files.
Thanks
def ftp_download(host, user, pswd, ftpdir, filename):
"""Downloads a single file from an FTP server"""
ftp = ftplib.FTP()
ftp.connect( host )
ftp.login ( user , pswd )
ftp.cwd ( ftpdir )
f = file( filename , "wb" )
ftp.retrbinary("RETR " + filename, f)