Is there a better way of listing Windows shares other than us ing "os.listdir"

Doran_Dermot at emc.com Doran_Dermot at emc.com
Thu Dec 30 12:03:55 CET 2004


Hi Tim,

That does the trick!  Now my gui remains responsive during the long search
time. 

Thanks!

-----Original Message-----
From: python-list-bounces+doran_dermot=emc.com at python.org
[mailto:python-list-bounces+doran_dermot=emc.com at python.org] On Behalf Of
Tim Golden
Sent: 30 December 2004 10:54
To: python-list at python.org
Subject: RE: Is there a better way of listing Windows shares other than us
ing "os.listdir"

[Doran_Dermot at emc.com]

| I'm currently using "os.listdir" to obtain the contents of 
| some slow Windows shares.  I think I've seen another way of 
| doing this using the win32 library but I can't find the 
| example anymore.

It may be FindFilesIterator, recently added to the win32file
module in pywin32. I don't know if it's any more efficient
than an os.listdir (which may use it under the covers, for
all I know) but it certainly works:

<code>
import win32file

for file_data in win32file.FindFilesIterator ("c:/temp/*"):
  ( attr, ctime, atime, wtime, 
    size_hi, size_lo, r0, r1, 
    longname, shortname
  ) = file_data
  print longname
</code>

TJG

________________________________________________________________________
This e-mail has been scanned for all viruses by Star. The
service is powered by MessageLabs. For more information on a proactive
anti-virus service working around the clock, around the globe, visit:
http://www.star.net.uk
________________________________________________________________________
-- 
http://mail.python.org/mailman/listinfo/python-list



More information about the Python-list mailing list