how to search directories under <PATH>

Larry Bates lbates at
Sat Jun 26 15:21:25 CEST 2004

os.path.exists() is what you want.

Secondly,  If you want to traverse path
hierarchy use os.path.walk().

Larry Bates
Syscon, Inc.

"Haim Ashkenazi" <haim at> wrote in message
news:mailman.162.1088208475.27577.python-list at
> Hi
> I have to write a function that returns a list of all directories under
> <PATH> (should work on linux and windows). it should be easy to write a
> loop that goes through every directory... and so on, but I was wondering
> if there's faster/more economic way, something like 'find <PATH> -type d'.
> I couldn't find any 'find' module for python.
> any ideas?
> thanx
> -- 
> Haim

More information about the Python-list mailing list