I have over a thousand folders, each folder contains one or more files with the following names:
Unordered:
Alison.ext Heather.ext Molly.ext Paula.ext Sam.ext
Here's a method that produces keys for ordering
public int OrderKey(string fileName)
{
char first = fileName[0];
int result =
first == 'M' ? 1 :
first == 'S' ? 2 :
first == 'H' ? 3 :
first == 'A' ? 4 :
first == 'P' ? 5 :
6;
return result;
}
Here's how to call it:
List ordered = Files.OrderBy(f => OrderKey(f.FileName)).ToList();