force cp to copy on dangling symlinks
Make cp
remove the target file before copying:
$ ln -s /random/file f
$ cp -f a f
cp: not writing through dangling symlink ‘f’
$ cp --remove-destination a f
$ diff a f && echo yes
yes
From man cp
:
--remove-destination
remove each existing destination file before attempting to open
it (contrast with --force)
Just use unlink theSymLink
where theSymLink
is the actual symlink, then try again