Alternative to os.listdir()/os.stat()

Alfredo P. Ricafort alpot at
Thu Jan 23 07:55:55 CET 2003


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:

    for i in range(len(fileList)):

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

Does one exists?


More information about the Python-list mailing list