ls files --> list packer

Kent Johnson kent at kentsjohnson.com
Sun Feb 26 22:56:51 EST 2006


kpp9c wrote:
> os.listdir works great ... just one problem, it packs the filenames
> only into a list... i need the full path and seach as i might i se NO
> documentation on python.org for os.listdir()

Docs for os.listdir() are here:
http://docs.python.org/lib/os-file-dir.html

When all else fails try the index:
http://docs.python.org/lib/genindex.html
> 
> how do i either grab the full path or append it later ...

Use os.path.join():

base = '/some/useful/path'
for f in os.listdir(base):
   full_path_to_file = os.path.join(base, f)

Kent



More information about the Python-list mailing list