Adrian Bastholm 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)
Hynek Schlawack added the comment:
I think your problem is a different one: os.listdir() doesn't return full paths
and os.path.isfile()/isdir() return False if the supplied path doesn't exist.
For example if you have this directory structure:
foo/
foo/bar/
foo/bar/baz
Calling os.listdir('foo
New submission from Adrian Bastholm :
os.path.isfile doesn't reckognize a .picasa.ini file as a file
and os.path.isdir doesn't reckognize a directory as a directory
code:
def traverse (targetDir):
currentDir = targetDir
dirs = os.listdir(targetDir)
#dirs = [x for x in os.listdir('.'