linux复制符号链接

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/10330984/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-06 05:59:46  来源:igfitidea点击:

linux copy symbolic link

linuxshellcommand-linesymlinkcp

提问by Robbo_UK

How do I copy a symbolic link from one directory to another?

如何将符号链接从一个目录复制到另一个目录?

ls -ls

file1.txt
file2.txt
files -> /mnt/iscsi-nfs-share/faulttracker-files

what I'm looking to do is copy files symbolic link into another directory?

我想要做的是将文件符号链接复制到另一个目录中?

cp files /var/copylinktohere/

the above results in cp: omitting directory `files'

以上结果在 cp: omiting directory `files'

采纳答案by dogbane

Use the -doption:

使用-d选项:

cp -d files /var/copylinktohere/

From man cp:

来自man cp

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

   --no-dereference
          never follow symbolic links