If the file system is the input tree, what I would like to do is to start from one folder, and scan each file within this folder and use the file name to search another place in the file system using some conditions like: filename = foldername, for each foldetname returned in this search, add this foldetname as a child to the output tree and search again until not more match.
So the input is a tree and output is also a tree. Recursion is what I think is required to solved the problem and hopefully someone can share ideas or examples or links , really appreciate!