This question already has an answer here:
I have a directory which contains many symlinks which point to other directories.
Now I would like to rename a common ancestral directory of the linked directories by the symlinks, and also have symlinks pointing to the same directories except with renamed pathnames.
For example, the symlinks point to
/home/Tim/dir2, ..., and now I would like the symlinks point to
I would like to automate the process of update the symlinks. But there are several questions:
I heard that symlinks can't be edited. So do I have to create new symlinks and then overwrite the existing ones?
how can I get the pathname of the directory pointed to by a symlink, and then use some text processing programs to replace the old name of the ancestral directory in the pathnames with its new name, and create a symlink pointing to the directory with a new pathname? Thanks.