Adrian Bastholm <[email protected]> added the comment:
You're right, my code was shite. Strange though it seemed to work on some
files. The following updated version does everything as intended with the help
of os.path.join:
def traverse (targetDir):
currentDir = targetDir
dirs = os.listdir(targetDir)
for entry in dirs:
if os.path.isdir(os.path.join(currentDir,entry)):
print("Traversing " + os.path.join(targetDir,entry))
traverse(os.path.join(targetDir,entry))
else:
if os.path.isfile(os.path.join(targetDir,entry)):
print("Processing" + " " + os.path.join(currentDir,entry))
else:
print("Not file: " + entry)
print("\n")
----------
_______________________________________
Python tracker <[email protected]>
<http://bugs.python.org/issue14985>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com