I have several files like this:
- C:\ByMe\SOLUTIONS\Dictation1\Database\Updates1717_04170405_TR_CREATE_TABLE_BMTApprovalGroupExam.sql
- C:\ByMe\SOLUTIONS\Dictation1\Database\Updates1717_04170405_TR_CREATE_PROC_BMSPInsertNewApprovalRequest2.sql
- C:\ByMe\SOLUTIONS\Dictation1\Database\Updates1717_04170405_TR_CREATE_PROC_BMSPUpdateApprovalRequest2.sql
- C:\ByMe\SOLUTIONS\Dictation1\Database\Updates1717_04170405_TR_CREATE_PROC_BMSPInsertNewApprovalGroupExam.sql
I need to sort the files like this in C #:
- C:\ByMe\SOLUTIONS\Dictation1\Database\Updates1717_04170405_TR_CREATE_TABLE_BMTApprovalGroupExam.sql
- C:\ByMe\SOLUTIONS\Dictation1\Database\Updates1717_04170405_TR_CREATE_PROC_BMSPInsertNewApprovalGroupExam.sql
- C:\ByMe\SOLUTIONS\Dictation1\Database\Updates1717_04170405_TR_CREATE_PROC_BMSPInsertNewApprovalRequest2.sql
- C:\ByMe\SOLUTIONS\Dictation1\Database\Updates1717_04170405_TR_CREATE_PROC_BMSPUpdateApprovalRequest2.sql
I did so:
string[] sqlFiles = Directory.GetFiles(path, "*.sql", SearchOption.TopDirectoryOnly);
foreach (string file in sqlFiles.OrderBy(file => file)) { }
But it's not working. It is performing by the first step I have.