FAQ
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

Search Discussions

  • Wittempj at Nov 24, 2006 at 3:42 pm

    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
  • Robert at Nov 24, 2006 at 3:53 pm

    wittempj at hotmail.com wrote:
    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)
    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
    would be even slower - 2 or 3 (network) calls for each file. os.walk just uses listdir.

    Robert

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
grouppython-list @
categoriespython
postedNov 24, '06 at 2:45p
activeNov 24, '06 at 3:53p
posts3
users2
websitepython.org

2 users in discussion

Robert: 2 posts Wittempj: 1 post

People

Translate

site design / logo © 2023 Grokbase