Get directory contents in date modified order
- by nevan
Is there an method to get the contents of a folder in a particular order? I'd like an array of file attribute dictionaries (or just file names) ordered by date modified.
Right now, I'm doing it this way:
get an array with the file names
get the attributes of each file
store the file's path and modified date in a dictionary with the date as a key
Next I have to output the dictionary in date order, but I wondered if there's an easier way? If not, is there a code snippet somewhere which will do this for me?
Thanks.