发新话题
打印

linux拷贝软连接文件的原始文件

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/

TOP

发新话题