I\'m using this script to connect to sample ftp server and list available directories:
from ftplib import FTP
ftp = FTP(\'ftp.cwi.nl\') # connect to host, defa
you can use a list. example
import ftplib
server="localhost"
user="user"
password="test@email.com"
try:
ftp = ftplib.FTP(server)
ftp.login(user,password)
except Exception,e:
print e
else:
filelist = [] #to store all files
ftp.retrlines('LIST',filelist.append) # append to list
f=0
for f in filelist:
if "public_html" in f:
#do something
f=1
if f==0:
print "No public_html"
#do your processing here