file system iteration

Tim Golden tim.golden at viacom-outdoor.co.uk
Mon Oct 9 16:13:43 CEST 2006


[Rick]
| Searching for a file by name. Scanning for viruses. Etc. 
| There are lots 
| of legitimate reason to walk all paths from a central 
| starting point, no???

Well, to get you started, I think this is the kind
of thing you'll want. Uses ctypes, which is built-in
to Python 2.5 so presumably legit.

<code>
import ctypes
import string

GetDriveType = ctypes.windll.kernel32.GetDriveTypeA

for letter in string.uppercase:
  print letter, "=>", GetDriveType ("%s:" % letter)

</code>

You'll have to refer to 

http://windowssdk.msdn.microsoft.com/en-us/library/ms685874.aspx

and various headers to get the values in question, but they
look quite straightforward at a glance.

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