On a Solaris box, I am trying to move the target of a symbolic link.
Let's say the symbolic link looks like the following:
/dir1/dir2/link -> /some/dir/target
I would like to know of a simple way to move the target of the symbolic link and not the link itself. I'd like to move /some/dir/target to /some/dir/target_v01 using the symbolic link as an argument to a command, if possible.
Using the mv command like below results in renaming the symbolic link and this is not the desired behavior in my case:
mv /dir1/dir2/link /dir1/dir2/target_v01
...will result in the rename of the symbolic link:
Create a redirect - a second link. Rename the original physical file, or create the second file - then create a symlink named as the original file name pointed at the new file name.
Don't get carried away - there is a limit to the number of links in a path.
The error code ELOOP:
ELOOP Too many symbolic links were encountered in resolving pathname, or O_NOFOLLOW was specified but pathname was a symbolic link
.
And having lots of links for a file is a maintenance mess - ie., backups etc.