fast listdir & stat

wittempj@hotmail.com martin.witte at gmail.com
Fri Nov 24 10:42:14 EST 2006


robert wrote:
> I want to get the files and sizes and times etc. stats of a dir fast.
> os.listdir & iterating with os.stat seems not to run at optimal speed for network folders. Is there a faster possibility? (both for Win & *nix ; best platform independent)
>
>
> Robert

An alternative is to work with os.walk() it returns a generator  - see
http://docs.python.org/lib/lib.html, and os.path.getsize(),
os.path.gettmtime() - see http://docs.python.org/lib/module-os.path.html




More information about the Python-list mailing list