Board logo

标题: linux拷贝软连接文件的原始文件 [打印本页]

作者: linda    时间: 2023-3-29 10:56     标题: linux拷贝软连接文件的原始文件

Without the -R switch, the behavior of cp -H and cp -L is identical.

With the -R switch, cp -H only dereferences symbolic links that occur in the cp command itself, while -L also dereferences symbolic links inside the recursively copied directories.

The command

cp -R -H source/ dest/
will copy the directory source and all its contents inside the directory dest. If source is a symlink to a directory, cp will dereference the symlink, i.e., copy the directory source points to. However, if cp encounters any symlinks in source's subdirectories, it will create symlinks in the destination folder.

The command

cp -R -L source/ dest/
behaves similarly. However, it will also dereference symlinks in source's subdirectories, i.e., copy the files those symlinks point to.

原文:https://superuser.com/questions/593196/cp-h-vs-cp-l-what-is-a-command-line-symbolic-link


tar压缩软链接文件:加 h 参数
tar chzvfp xxx.tgz xxx/




欢迎光临 中神通公司交流论坛 (http://trustcomputing.com.cn/bbs/) Powered by Discuz! 6.0.0