[Tutor] walking down directories

Alan Gauld alan.gauld at freenet.co.uk
Sat Mar 18 13:53:22 CET 2006


>I am trying to write a function that takes a
> directory's name, finds any subdirectories, and then
> prints out the size of the files in all found
> directories.

> As you see, the problem is that there is another
> directory under testFiles called testDir, but the
> function doesn't check the directory for files.  The
> function needs to find every directory (including
> subdirectories within directories).  Any hints?  

You mean like the os.walk fiunction does?

Take a look at the OS topic in my tutor for an example
of using os.walk - its about quarter oif the way down.

Alan G.



More information about the Tutor mailing list