Sorting the directories from which images are extracted (needed for unix).