That is just what I did to begin with but I forgot the tailing backslash. Of course I thought "Hmm I need to detect the component boundary". I didn't follow up that train of thought. For some reason my mind jumped to a hash table to represent the filesystem tree.
Today everything has been done "under pressure". :\