Я копирую код с сервера, используя rsync
через ssh
:
rsync -avzhe ssh --progress root@ecash-staging:/to/path/file /path/
Есть каталог с символической ссылкой, который не может быть скопирован, но мне нужно содержимое целевой ссылки.
1) Как я могу скопировать этот каталог, а затем сделать tar-файл и скачать или скопировать на локальную машину с сервера?
2) Или мы можем скачать эту директорию прямо на локальную машину? Если да, то как?
Взгляните на 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/