Correctly handle overwriting directory symlinks.