Quicker and Cleaner python recursive folder search
As contributor of the day, Jason Scheirer, pointed out, python has a simple, direct way to browse through the subdirectories of a directory–os.walk
Here is a bare-bones example of using it to print out the subdirectories in a path. The files variable of the 3-tuple is a list of files similar to the dirs variable that I loop through.
Thanks Jason for pointing out something I missed.
import os
theDir = 'c:/temp/'
for root, dirs, files in os.walk(theDir,True,None):
for idir in dirs:
print " directory: {0}/{1}".format(root,idir)