Hi,
Just came up with this function, don't know where else to put it so ......
def ftpwalk(ftp, top, func, arg):
''' ftpwalk just like os.path.walk functions...
first argumant is the ftp object, second and
subsequent are same as os.path.walk
'''
try:
ftp.cwd(top)
except:
return # not a directory?? this must be the end.....
names=ftp.nlst(top)
func(arg, top, names)
for name in names:
name = os.path.join(top, name)
try:
ftp.cwd(name)
except:
continue
ftpwalk(ftp, name, func, arg)
Martin
Martin Franklin wrote in comp.lang.python:
> Hi,
>
> Just came up with this function, don't know where else to put it so
> ......
Maybe you should submit it to the ftp object maintainer for inclusion.
Markus
--
"GPL software is not free - the cost is cooperation"
You could put it into the Python Cookbook:
http://aspn.activestate.com/ASPN/Cookbook/Python
or at faqts: http://www.faqts.com/knowledge_base/index.phtml/fid/545.
Daniel