I have text files located in a directory. The text files are ordered by name in that directory. I want to read the paths of those text files with same order (by name) into array. I’m using the following code :
string[] textpaths = Directory.GetFiles(filepath + "\\source", "*",
SearchOption.AllDirectories);
But the array of paths I got doesn’t has the same directory order. Could any one help please?
Thanks in advance.
In which order, you can always sort the files using simple linq queries.
Alternatively you can you DiretoryInfo.GetFiles to sort it using other attributes.