Some nasty magic with directories