directory.getfiles sort by name code example Example: Directory.GetFiles sorted by name var sorted = Directory.GetFiles(".").OrderBy(f => f);