how to search directories under <PATH>

Haim Ashkenazi haim at
Sat Jun 26 17:04:42 CEST 2004

On Sat, 26 Jun 2004 08:21:25 -0500, Larry Bates wrote:

> os.path.exists() is what you want.
> Secondly,  If you want to traverse path
> hierarchy use os.path.walk().
it shows I'm a newbie... :)

I already found out that os.walk do exactly what I want:

for root, dirs, files in walk(<PATH>):
	for dir in dirs:
		list.append(root + dir)

this will generate a list of directories under <PATH>


More information about the Python-list mailing list