Hints about a script that read ftp contents ....

simon place simon_place at whsmithnet.co.uk
Tue Aug 12 13:09:42 EDT 2003


isn't that just a rewrite of the built-in walk function?

but if you want check ftputil again, it has a isdir() function that calls 
'LIST' and interprets the result, this i think is what makes the walk function 
very slow, since it has to call 'LIST' and make a new socket for the reply, a 
very large number of times, a walk on my site ( 50 files 5 dirs. ) took 
several minutes,

an idea.
a rewrite of walk that does 'CWD' (change working directory) and using the 
reply code to tell retrospectively if its a directory, might not be a lot more 
efficient, the current method has the benefit that it gets file size, dates 
etc., but due the way its coded does a 'LIST' for each file!, for a walk you 
only need to know if its a directory and you'll have to do a 'CWD' anyway, 
also you don't generate any new sockets.





More information about the Python-list mailing list