0

Greeting

I am using Python 3.6 to list ALL file in a specific folder, I am strictly required to list the file sorted by the creation Date/Time in order to process them later based on Date/Time.

I was able to successfully use the following piece of code to list all the required files, interestingly, they came in a SORTED order by Date/Time !!

Does this way ALWAYS GUARANTEE that the files will be list in sorted order ?

Thanks

import sys

Source_Path      = 'C:/Myfolder'

for One_File in os.listdir(Source_Path):
    print(One_File)

1 Answers1

0

import os

Source_Path = 'C:/Myfolder'

for One_File in os.listdir(Source_Path): print(One_File)

You, import sys instead of os

IsaBostan
  • 60
  • 4