import ftputil
host = ftputil.FTPHost(‘host’,'www’,'pass’)
names = host.listdir(“/”)
i = 0
for name in names:
i = i + 1
print i
if(i>1):
for name in names:
s = ['/',name]
d = ”.join(s)
if(name!=names[i-1]):
host.remove(d)