in reply to Following symlinks manually

You might be looking for my article on expanding symbolic links, at least as a way to look at the strategy of solving it. Perhaps a module has arisen since 1999 to solve it more directly.