rsync
我正在使用over从服务器复制代码ssh
:
rsync -avzhe ssh --progress root@ecash-staging:/to/path/file /path/
有一个无法复制的符号链接目录,但我需要链接目标的内容。
1)如何复制该目录,然后制作 tar 文件并从服务器下载或复制到本地计算机上?
2)或者我们可以将该目录直接下载到本地计算机上吗?如果是,那么如何?
答案1
看一下man rsync
。这里的相关部分是:
SYMBOLIC LINKS
Three basic behaviors are possible when rsync encounters a symbolic
link in the source directory.
By default, symbolic links are not transferred at all. A message
"skipping non-regular" file is emitted for any symlinks that exist.
If --links is specified, then symlinks are recreated with the same tar‐
get on the destination. Note that --archive implies --links.
If --copy-links is specified, then symlinks are "collapsed" by copying
their referent, rather than the symlink.
因此,您所需要做的就是添加选项--copy-links
:
rsync -avzhe ssh --progress --copy-links root@ecash-staging:/to/path/file /path/