sort directory before starting the search