I have insane big directory. I need to get filelist via python.
In code i need to get iterator, not list. So this not work:
os.listdir
glob.glob (uses l
Someone built a python module off that article that wraps getdents
. Btw, I know this post is old, but you could use scandir
(and I have done that with dirs with 21 million files). Walk is way too slow though it is also a generator but too much overhead.
This module seems like it would have been an interesting alternative. Have not used it, but he did base it off 8 million files LS article referenced above. Reading through the code, thinking this would have been fun and faster to use.
Also allows you to tweak the buffer without having to go into C directly.
https://github.com/ZipFile/python-getdents And via pip and pypi though I recommend reading the docs.
https://pypi.org/project/getdents/