Using Python to Fetch Files from an FTP Server : Ftp : Network PYTHON TUTORIALS


PYTHON TUTORIALS » Network » Ftp »

 

Using Python to Fetch Files from an FTP Server


import ftplib

ftp = ftplib.FTP('ftp.novell.com', 'anonymous','b@n.com')
print "File List:"
files = ftp.dir()
print files

ftp.cwd("/pub")
gFile = open("readme.txt""wb")
ftp.retrbinary('RETR Readme', gFile.write)
gFile.close()
ftp.quit()

gFile = open("readme.txt""r")
buff = gFile.read()
print buff
gFile.close()



Leave a Comment / Note


 
Verification is used to prevent unwanted posts (spam). .


PYTHON TUTORIALS

 Navioo Network
» Ftp