views:

793

answers:

3

It is an odd behaviour seen only on Solaris that when I try to copy a symbolic link with the "cp -R -P" command to some other folder with a different name, it copies the entire directory/file it's pointing to.

For example:

link -> dir

cp -R -P link folder/new_link
A: 

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

MarkusQ
A: 

You might consider copying via tar, like tar -cf - srcdir|(cd somedir;tar -xf -)

Brian Mitchell
+1  A: 

http://docs.sun.com/app/docs/doc/816-5165/cp-1?a=view seems to say that you want to use an '-H' to preserve symlinks within the source directory.

BonkaBonka