DFlow
DFlow

Reputation: 11

Sorting a .Getfiles in alphabetic and numeric order

Hello guys I am trying to Get files from a folder that contains Episodes of a show that has more than 100 episodes. But When I retrieve the files with d.GetFiles("*.*", SearchOption.TopDirectoryOnly) It is giving me all the files but It is getting episode 100 right after 1 and 2 after 100+. How can I get the files in correct order?

Upvotes: 0

Views: 510

Answers (1)

DFlow
DFlow

Reputation: 11

Got it to working. The class Implements IComparer(Of String) accepts List of string. Because of this I just had to convert the GetFiles to a List(Of String) and then sort the List as so:

The_Files = Directory.GetFiles(Folder_Browser_Dialog.SelectedPath & "\" & i, "*.*").ToList
The_Files.Sort(New MyComparer)

This worked PERFECTLY Thank you soo much @jmcilhinney

Upvotes: 1

Related Questions