Sort All the Files in a Directory Tree

This function sorts all the files in a directory tree by modification time.

To obtain the modification time, the program calls the built-in function stat(). This returns a list with 13 elements. The modification time is the 10th element of this list; the rest can be ignored.

To display the modification time, the program calls localtime(), which returns a nine-element list. The program cares only about the first six, which are seconds, minutes, hours, day, month, and year, except the month is zero-based and the year has 1900 subtracted from it. (The other three elements in the list are day of the week, day ...

Get Find the Bug A Book of Incorrect Programs now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.