I don't quite understand which function should I use to gradually iterate over files in a directory (non-recursively) without precaching them all in a one huge list.
I checked the documentation of os.scandir()
, but it doesn't explicitly specify whether or not it loads the entire list into memory at once.
I've also checked the documentation on .iglob()
, but it was later revealed that it does store all the items in memory...