file system iteration

Tim Golden tim.golden at
Mon Oct 9 16:13:43 CEST 2006

| 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.

import ctypes
import string

GetDriveType = ctypes.windll.kernel32.GetDriveTypeA

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


You'll have to refer to

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


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:

More information about the Python-list mailing list