os.walk(entire filesystem)

Larry Bates lbates at syscononline.com
Wed Mar 9 19:24:16 EST 2005


I don't think what you want would even work.  You can't walk A:
unless a floppy is present, O/S will bark at you.  You can't
walk D: (cdrom drive) unless a CDROM is present.  What about
network drives???  Unlike Linux where these directories appear
to be empty if nothing is mounted Windows tries to read a
directory and errors.  Just follow what Peter Hansen has
suggested and write a wrapper function that calls os.walk
repeatedly for all the actual drives in your system
that are readable at all times.  It isn't all that hard.

Larry Bates


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!



More information about the Python-list mailing list