Find lowest level directory

2012-12-13 Thread loial
How can I find the full path of the lowest level directory in a directory structure? If there is more than one directory at the lowest level, the first one found will be enough. Any help appreciated -- http://mail.python.org/mailman/listinfo/python-list

Re: Find lowest level directory

2012-12-13 Thread Mark Lawrence
On 13/12/2012 12:48, loial wrote: How can I find the full path of the lowest level directory in a directory structure? If there is more than one directory at the lowest level, the first one found will be enough. Any help appreciated Take a look at the os.path functions. Note that

Re: Find lowest level directory

2012-12-13 Thread Peter Otten
loial wrote: How can I find the full path of the lowest level directory in a directory structure? If there is more than one directory at the lowest level, the first one found will be enough. import os def directories(root): for path, folders, files in os.walk(root): for name