Since the purge code "simplifies" the rest of the script's logic by deleting symlinks and a directory, a dry run ends up getting errors in the destination directory/symlink check. These aren't legitimate errors since a non-dry-run will actually go through just fine after the offending items are removed.
So... I think the fix is to do purging properly - skip the directory/symlink checks, and move the delete operation to where it fits in the sequence rather that doing it first in the hopes of avoiding excessive "if" blocks.
Since the purge code "simplifies" the rest of the script's logic by deleting symlinks and a directory, a dry run ends up getting errors in the destination directory/symlink check. These aren't legitimate errors since a non-dry-run will actually go through just fine after the offending items are removed.
So... I think the fix is to do purging properly - skip the directory/symlink checks, and move the delete operation to where it fits in the sequence rather that doing it first in the hopes of avoiding excessive "if" blocks.