I have a program where I am parsing sql scripts in order of the file directory. The idea from the team was that changes or additions to the sql scripts were done in order, and so the folders are named from 0 to 12. So I need to parse through these folders in numerical order, however when they are parsed in order, these are the order in which I am placing them as the Key in the dictionary:
C:\Dev\FileResearch\ParseSqlConsole\DbScriptFolders\0
C:\Dev\FileResearch\ParseSqlConsole\DbScriptFolders\1
C:\Dev\FileResearch\ParseSqlConsole\DbScriptFolders\10
C:\Dev\FileResearch\ParseSqlConsole\DbScriptFolders\11
C:\Dev\FileResearch\ParseSqlConsole\DbScriptFolders\12
C:\Dev\FileResearch\ParseSqlConsole\DbScriptFolders\2
C:\Dev\FileResearch\ParseSqlConsole\DbScriptFolders\3
etc...
When I iterate through this dictionary, I want to run these folders in numerical order so I can build my sql scripts in the order they were designed. I have the path saved as the key (string), and I need to reorganize them so that the path folders are listed in numerical order. So that they look like this:
C:\Dev\FileResearch\ParseSqlConsole\DbScriptFolders\0
C:\Dev\FileResearch\ParseSqlConsole\DbScriptFolders\1
C:\Dev\FileResearch\ParseSqlConsole\DbScriptFolders\2
C:\Dev\FileResearch\ParseSqlConsole\DbScriptFolders\3
etc...
C:\Dev\FileResearch\ParseSqlConsole\DbScriptFolders\9
C:\Dev\FileResearch\ParseSqlConsole\DbScriptFolders\10
C:\Dev\FileResearch\ParseSqlConsole\DbScriptFolders\11
C:\Dev\FileResearch\ParseSqlConsole\DbScriptFolders\12
My Dictionary structure is in the form of <string, List<string>>
. I am looking at a file directory that holds a series of folders, and each folder holds a handful of SQL files for building a database. My Dictionary Keys are the folder paths for the subfolders inside this directory, and the values is a List of strings that hold the paths for those files inside the folder path in the Key. I'll edit my question to mention this. How can I order my dictionary by my keys in numerical order?