precompute directory hierarchy