Directory in Windows

custard_pie ckwiguno at gmail.com
Sat Apr 30 14:25:29 EDT 2005


Here's my code
========================================================
filelist={}
def listFiles(self, dirName, filesInDir):
	for fname in filesInDir:
		if os.path.isfile(fname):
			key = os.path.join(dirName, fname)
			stats = os.stat(fname)
			filelist[key] = (stats[stat.ST_MTIME], stats[stat.ST_SIZE])
os.path.walk(string.strip(self.path.get()), listFiles, None)
print filelist
=======================================================
I change: if not os.path.isdir(fname) to if os.path.isfile(fname)
because some directories are not recognized as directory, and I get an
error message because os.stat is called with the directory as arg. But
even after I change it into isfile(). There are still some
errors,..some images in the subdirectories won't get printed...
Help please....




More information about the Python-list mailing list