Python Forum
Anyone play with os.scandir? It is awsome!
Thread Rating:
  • 2 Vote(s) - 2 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Anyone play with os.scandir? It is awsome!
#1
I'm just wondering if anyone else has played with the following:

I have been fed up with windows 7 explorer search for a long time,
but with grep available for windows, I haven't ever tried to write a
search engine for it myself.

Recently, I discovered os.scandir written by Ben Hoyt

see: https://www.python.org/dev/peps/pep-0471/
and: http://benhoyt.com/writings/scandir/

i have not done much with it yet, but interactively
ran it and iterated over the results, simply writing each item out to disk,
and then editing the file with Notebook++

I passed as a path the root directory of a 5TB drive, which had .5 TB populated
I didn't think anything had happened when I ran it the first time, because it only ran for a few seconds.
Then when I opened the results file, I was amazed to find 299,681 entries containing all files and their full path.

There's more, I haven't found out how to access it yet, but also gets the os.stat and 'other' information as well.
the claim is that it's 20 times faster than os.walk.
Reply


Messages In This Thread
Anyone play with os.scandir? It is awsome! - by Larz60+ - Sep-09-2017, 12:29 AM

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020