Answer of exercise 2

Here are some hints. We move up from the current position towards the root and construct backwards the path we are looking for. The root can be detected as the only directory node whose parent is equal to itself (relative to the root . and .. are equal). To find the name of a directory r we need to list the contents of its parent directory and detect the file that corresponds to r.

* * *