os.walk(entire filesystem)

Uwe Becher ubecher at gmx.net
Thu Mar 10 14:11:10 EST 2005


rbt wrote:
> More of an OS question than a Python question, but it is Python related 
> so here goes:
> 
> When I do os.walk('/') on a Linux computer, the entire file system is 
> walked. On windows, however, I can only walk one drive at a time (C:\, 
> D:\, etc.). Is there a way to make os.walk() behave on Windows as it 
> behaves on Linux? I'd like to walk the entire file system at once... not 
> one drive at a time.
> 
> Thanks!

You would need a wrapper to retrieve all logical drives using 
win32api.GetLogicalDriveStrings(),check the drive type with 
win32file.GetDriveType() and then os.walk() those local fixed drives.

Hth
Uwe



More information about the Python-list mailing list