Grasshopper,
There is a fundamental flaw in your logic. There is no way to control with absolute certainty, the order of keys (values) in an INI file if it is written with the WriteProfileString() function or API. Since you are nesting folders, there is significance as to their order. You would be better off to have the whole folder structure as one key (value) data.

I.E.
[GroupName]
FolderA=department\team\folderA
FolderB=department\team\folderB

Then Split() out each folder level
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.