[Tutor] directory recursion

Danny Yoo dyoo at hkn.eecs.berkeley.edu
Fri Sep 9 21:59:14 CEST 2005



On Fri, 9 Sep 2005, Rob Andrews wrote:

> I should already know this, and probably once did, but have never had
> a real world use for it until now.
>
> What's a nice, clean way to recursively scan through directories with
> an arbitrary number of subdirectories?

Hi Rob,

You may want to look at os.walk():

    http://www.python.org/doc/lib/os-file-dir.html#l2h-1628

If you have questions on it, please feel free to ask!

Hope this helps!



More information about the Tutor mailing list