How to copy symbolic links?

Posted by Basilevs on Super User See other posts from Super User or by Basilevs
Published on 2010-05-07T04:36:38Z Indexed on 2010/05/07 4:38 UTC
Read the original article Hit count: 232

Filed under:
|

I have directory that contains some symbolic links:

user@host:include$ find .. -type l -ls
4737414    0 lrwxrwxrwx   1 user group       13 Dec  9 13:47 ../k0607-lsi6/camac -> ../../include
4737415    0 lrwxrwxrwx   1 user group       14 Dec  9 13:49 ../k0607-lsi6/linux -> ../../../linux
4737417    0 lrwxrwxrwx   1 user group       12 Dec  9 13:57 ../k0607-lsi6/dfc -> ../../../dfc
4737419    0 lrwxrwxrwx   1 user group       17 Dec  9 13:57 ../k0607-lsi6/dfcommon -> ../../../dfcommon
4737420    0 lrwxrwxrwx   1 user group       19 Dec  9 13:57 ../k0607-lsi6/dfcommonxx -> ../../../dfcommonxx
4737421    0 lrwxrwxrwx   1 user group       17 Dec  9 13:57 ../k0607-lsi6/dfcompat -> ../../../dfcompat

I need to copy them to the current directory. The resulting links should be independent from their prototypes and lead directly to their target objects.

  • cp -s creates links to links that is not appropriate behavior.
  • cp -s -L refuses to copy links to directories
  • cp -s -L -r refuses to copy relative links to non-working directory

What should I do?

© Super User or respective owner

Related posts about symbolic-link

Related posts about copy