How to move / copy a symlink to another folder as a symlink in Solaris?

This is an odd behavior observed only in Solaris, when I try to copy a symbolic link with the " cp -R -P" command to another folder with a different name, it copies the entire directory / file that it points to.

For example:

link -> dir

cp -R -P link folder/new_link
+3
source share
4 answers

I believe the argument β€œ-d” is what you need.

According to cp man page :

-d     same as --no-dereference --preserve=link

Example:

cp -d -R -P link folder/new_link

I used "cp -d" and it worked for me.

+4
source

cp man, , , -H .

+2

Try using cpio (with -p (pass)) or the old tar in the pipe trick.

0
source

You might consider copying through tar, for example tar -cf - srcdir | (cd somedir; tar -xf -)

0
source

Source: https://habr.com/ru/post/1705809/


All Articles