On some file systems reading files in inode order is considerably faster than in the (?random) order returned by os.walk. This may be because inode order more faithfully represents the physical location of files on disk and therefore enables more efficient file access (e.g. by reducing seeking). Consider scanning the directory with something like scandir() and then walking through the files in inode order.
On some file systems reading files in inode order is considerably faster than in the (?random) order returned by os.walk. This may be because inode order more faithfully represents the physical location of files on disk and therefore enables more efficient file access (e.g. by reducing seeking). Consider scanning the directory with something like scandir() and then walking through the files in inode order.