I have a flat directory with large amount of files:
myFolder:
| 000001.csv
| 000002.csv
| 000003.csv
...
| 100000.csv
I need to read them in alphanumeric order and process them. Normal way to do it would be:
files = sorted(os.listdir(json_event_dir))
for file in files:
with open(file) as f:
process(file)
But I don't want to store files
. Is there a way to make a generator of ordered files in a directory?