<!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 />: &gt; Hello Nicola,<br />&gt; <br />&gt; What I like about your reports is that you always provide<br />&gt; concrete examples with working test code. Great! :-)<br /><br />and your answers are ever rich of quality valuable infos, thanks!<br /><br />&gt; <br />&gt; On 2009-04-29 22:46, MailingList SVR wrote:<br />&gt; &gt; I need to distinguish beetween file and folder, I'm using<br />&gt; &gt; host.path.isdir and host.path.isfile but these seems really slow.<br />&gt; &gt; <br />&gt; &gt; Here is an example code:<br />&gt; &gt; <br />&gt; &gt; host=ftputil.FTPHost('ftp.nluug.nl','anonymous','pippo@pippo.com')<br />&gt; &gt; folder='/vol/1/centoslinux/5.3/os/SRPMS/'<br />&gt; &gt; lista=host.listdir(folder)<br />&gt; &gt; <br />&gt; &gt; # host.listdir is fast, good!<br />&gt; &gt;<br />&gt; &gt; for l in lista:<br />&gt; &gt;         print folder+l<br />&gt; &gt;         print datetime.datetime.now()<br />&gt; &gt;        #host.path.isdir and isfile are slow :-(<br />&gt; &gt;         if host.path.isdir(folder+l):<br />&gt; &gt;                 print 'dir:'<br />&gt; &gt;                 print datetime.datetime.now()<br />&gt; &gt;         if host.path.isfile(folder+l):<br />&gt; &gt;                 print 'file:'<br />&gt; &gt; <br />&gt; &gt; and this is the output:<br />&gt; &gt; [...]<br />&gt; <br />&gt; Running this with ftputil 2.4 on my computer takes about<br />&gt; 25 minutes. When increasing the cache size to 2000, the code<br />&gt; runs in about 40 seconds. :)<br />&gt;<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 />&gt; For the details, please read this section of the ftputil<br />&gt; documentation:<br />&gt; <br />&gt; http://ftputil.sschwarzer.net/trac/wiki/Documentation#local-caching-of-file-system-information<br />&gt; <br />&gt; (context: the directory you work on has 1193 items in it, and<br />&gt; ftputil's default cache size is 1000)<br />&gt;<br />&gt; Best regards,<br />&gt; Stefan<br />&gt; _______________________________________________<br />&gt; ftputil mailing list<br />&gt; ftputil@codespeak.net<br />&gt; http://codespeak.net/mailman/listinfo/ftputil<br />&gt; <br /><br /><br /></p></body></html>