<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"><html><head><meta name="qrichtext" content="1" /><style type="text/css">p, li { white-space: pre-wrap; }</style></head><body style=" font-family:'Bitstream Vera Sans'; font-size:10pt; font-weight:400; font-style:normal;"><p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">In data giovedì 30 aprile 2009 21:54:11, Stefan Schwarzer ha scritto:<br />: > Hello Nicola,<br />> <br />> What I like about your reports is that you always provide<br />> concrete examples with working test code. Great! :-)<br /><br />and your answers are ever rich of quality valuable infos, thanks!<br /><br />> <br />> On 2009-04-29 22:46, MailingList SVR wrote:<br />> > I need to distinguish beetween file and folder, I'm using<br />> > host.path.isdir and host.path.isfile but these seems really slow.<br />> > <br />> > Here is an example code:<br />> > <br />> > host=ftputil.FTPHost('ftp.nluug.nl','anonymous','pippo@pippo.com')<br />> > folder='/vol/1/centoslinux/5.3/os/SRPMS/'<br />> > lista=host.listdir(folder)<br />> > <br />> > # host.listdir is fast, good!<br />> ><br />> > for l in lista:<br />> > print folder+l<br />> > print datetime.datetime.now()<br />> > #host.path.isdir and isfile are slow :-(<br />> > if host.path.isdir(folder+l):<br />> > print 'dir:'<br />> > print datetime.datetime.now()<br />> > if host.path.isfile(folder+l):<br />> > print 'file:'<br />> > <br />> > and this is the output:<br />> > [...]<br />> <br />> Running this with ftputil 2.4 on my computer takes about<br />> 25 minutes. When increasing the cache size to 2000, the code<br />> runs in about 40 seconds. :)<br />><br /><br />works in about 40 seconds on my box too, this time is acceptable, however on the same directory a standard ftpclient give the directory listing in few seconds. I haven't look at ftputil code but host.listdir is fast such as filezilla and company (2-3 seconds) what other tasks ftputil does in about 35 seconds? It is possible to have a fastest listing or the code is already optimized?<br /><br />thanks<br />Nicola<br /><br /><br /><br /><br />> For the details, please read this section of the ftputil<br />> documentation:<br />> <br />> http://ftputil.sschwarzer.net/trac/wiki/Documentation#local-caching-of-file-system-information<br />> <br />> (context: the directory you work on has 1193 items in it, and<br />> ftputil's default cache size is 1000)<br />><br />> Best regards,<br />> Stefan<br />> _______________________________________________<br />> ftputil mailing list<br />> ftputil@codespeak.net<br />> http://codespeak.net/mailman/listinfo/ftputil<br />> <br /><br /><br /></p></body></html>