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

Tim Golden tim.golden at viacom-outdoor.co.uk
Thu Dec 30 05:54:03 EST 2004


[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
________________________________________________________________________



More information about the Python-list mailing list