[ftputil] Ftputil seems really slow to distinguish file and folders

Stefan Schwarzer sschwarzer at sschwarzer.net
Fri May 1 19:22:26 CEST 2009


Hi Nicola,

On 2009-05-01 17:44, MailingList SVR wrote:
> what I mean for fast mode is use only host.listdir to provide the
> distintion beetween files and directory. Is it possible to retrieve this
> basic info only with listdir and so in 1.2 seconds? This way we can give
> a very fast directory listing and for example give the whole
> informations only if len(host.listdir) < x

Yes and no. Actually, listdir saves a stat object for each item
in the directory it retrieves (see method _real_list_dir in the
module ftp_stat.py). This is the cache data you would access if
you implemented the approach I showed in my last mail. However,
there's currently no way (and most probably won't be) of getting
this stat data directly as a return value of the listdir call
(or rather not without modifying ftputil's code; you'll have to
patch the code for this yourself).

If the experiment I pointed at proves to be a great success, I
_may_ add a way to ftputil to plug in the "dumb" ;) but fast
cache.

Best regards,
Stefan




More information about the ftputil mailing list