Re: Directory in Windows
- From: "custard_pie" <ckwiguno@xxxxxxxxx>
- Date: 30 Apr 2005 11:25:29 -0700
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....
.
- Follow-Ups:
- Re: Directory in Windows
- From: Marc 'BlackJack' Rintsch
- Re: Directory in Windows
- References:
- Directory in Windows
- From: custard_pie
- Re: Directory in Windows
- From: Kent Johnson
- Directory in Windows
- Prev by Date: Re: Directory in Windows
- Next by Date: Re: User Directory Path
- Previous by thread: Re: Directory in Windows
- Next by thread: Re: Directory in Windows
- Index(es):
Relevant Pages
|