Improved performace for file iterator on sort_files.py