os.path.walk() to get full path of all files
dude
erniedude at gmail.com
Wed Mar 16 15:41:30 EDT 2011
My goal is create a list of absolute paths for all files in a given
directory (any number of levels deep).
root
----dir1
--------file1
--------file2
--------dir2
------------file3
--------dir3
-------------dir4
------------------file4
----file5
So the above would return:
[root/dir1/file1, root/dir1/file2, root/dir1/dir2/file3, etc...]
I've been trying different ways of using os.path.walk() for that, but
I can't find an elegant way. Anyone know of something simple to
accomplish that?
More information about the Python-list
mailing list