Deleting directories while preserving symlinks

At work, we needed to replace a pre-existing folder with a symlink. We wanted to symlink the user’s .git/hooks folder to ../build/git-hooks every time the script was run. We wanted to delete .git/hooks if it existed and replace it with a symlink, but we also wanted to avoid deleting ../build/git-hooks‘s contents by accident if the […]