rewriting directories