Alternative to os.listdir()/os.stat()
Alfredo P. Ricafort
alpot at mylinuxsite.com
Thu Jan 23 01:55:55 EST 2003
Hi,
I'm trying to get the files under a directory and its details. What I
did is to call os.listdir() and then os.stat(). So my code looks
something like this:
fileList=os.listdir(path)
for i in range(len(fileList)):
f=os.stat(path+'/'+j)
However, I noticed that this approach takes a long time when the
directory contains lots of files. So what I am looking for now is a
function that can give me the details is one go, much like 'ls -ltra' in
UNIX.
Does one exists?
AL
More information about the Python-list
mailing list