Apply some logic to your code formatting so that you might be better able to apply logic to your coding. At any rate it would greatly decrease the time spent reading your code by the people you ask to do so.
The code you have will usually display files alphabetically, afaik, but if it doesn't, read the files into your array, then sort the array, then display the array.