Find lowest level directory
__peter__ at web.de
Thu Dec 13 16:49:27 CET 2012
> How can I find the full path of the lowest level directory in a directory
> If there is more than one directory at the lowest level, the first one
> found will be enough.
for path, folders, files in os.walk(root):
for name in folders:
yield os.path.join(path, name)
some_folder = ...
print max(directories(some_folder), key=depth)
More information about the Python-list