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
4

4 回答 4

4

我相信“-d”参数是您所需要的。

根据cp 手册页

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

例子:

cp -d -R -P link folder/new_link

我正在使用“cp -d”,这对我有用。

于 2011-11-08T23:46:12.747 回答
2

cp 手册页似乎说您想使用“-H”来保留源目录中的符号链接。

于 2009-04-02T18:20:59.050 回答
0

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

于 2009-04-02T18:17:46.250 回答
0

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

于 2009-04-02T18:18:17.307 回答