Sort on basis on File names

Hi Bot makers,

I have few files in a folder whose naming convention is 01_firstcopy.pdf, 02_secondcopy.pdf …99_ninetyninecopy.pdf.
Now i want to merge files one by one based on desc order i.e i want to pick 01 file first and 02 next and so on … The problem is I am able to retrive 01 file then its going to 11 th file instead of 2 the expected order was 1,2,3,4,5,6,7,8,9,10,11,…
but the order i am getting in output is 1,11,2,22,3,33,…
Could you please help me a clear and simple solution.

Thanks,
Shabaz

1 Like

Hi @SyedShabaz03

**dir_info.GetFiles().OrderByDescending(Function(x) x.filename)

Thanks
Ashwin.S

Hi Ashwin.
If folder names in ascending order.