There is a recursive function for indexing directories and files. I need to create a hierarchical view of the file structure. I iterate over the variable (let it be i) on each pass of the recursive function. That is, deep into the iteration goes as it should. But when it comes to the next folder, which is higher level, the iteration does not roll back to the previous state. How can you avoid this phenomenon? An example of how it should be done: 1-2-3-4-5-6-2-3-4-2-3 (numbers are node identifiers). what turns out: 1-2-3-4-5-6-7-8-9-9-10-11
And, yes, YaP-C #.