I am trying to list directories and files (recursivley) in a directory with python:
./rootdir ./file1.html ./subdir1 ./file2.html ./file3.html
Try the following:
for path, dirs, files in os.walk("."): print path for file in files: print os.path.join(path, file)
You do not need to print entries from dirs because each directory will be visited as you walk the path, so you will print it later with print path.
dirs
print path