I have some files in my directory.
09001-1.pdf, 09001-2.pdf, 09001-3.pdf, 09001-4.pdf, 09001-5.pdf, 09001-6.pdf, 09001-7.pdf, 09001-8.pdf, 09001-9.pdf, 09001-10.pdf, 09001-11.pdf, 09001-12.pdf, 09001-13.pdf in the same order.
When i wrote code for retrieving files from directory, I got output like this
09001-1.pdf, 09001-10.pdf, 09001-11.pdf, 09001-12.pdf, 09001-13.pdf, 09001-2.pdf, 09001-3.pdf, 09001-4.pdf, 09001-5.pdf, 09001-6.pdf, 09001-7.pdf, 09001-8.pdf, 09001-9.pdf
why is this and how can i get output in the same format as i have files in my directory? Please tell me.
Retrieving file names from directory
2 Answers
Know the answer? Post it. Somebody with the same question will find it here.

Master BillaRank #2,229 · 630 reputationPosted Sep 9, 2009, 9:15 PM EDT
When you are retrieve the file from the directory it sort like char base, so see your sequence came like on that way.
try this way
DirectoryInfo info = new DirectoryInfo();
FileInfo[] files = info.GetFiles();
May be help
thank you
Roei BarRank #1,271 · 1.4K reputationPosted Sep 9, 2009, 9:18 PM EDT
DirectoryInfo info = new DirectoryInfo();
FileInfo[] files = info.GetFiles();
foreach (FileInfo _file in files)
{
Console.WriteLine(_file.Name);
}