0

I am copying code from a server using rsync over ssh:

rsync -avzhe ssh --progress  root@ecash-staging:/to/path/file /path/

There is a symbolic link directory which cannot be copied, but I need the contents of the link target.

1) How can I copy that directory and then make a tar file and download or copy on local machine from server?

2) Or can we download that directory directly on to local machine? If yes, then how?

  • I removed your third question since we don't know why whoever set up your system chose to use symbolic links. Now, please edit your question and clarify why you need a tar.gz file. That doesn't seem related to your actual issue and questions here should only ask a single question at a time. – terdon Oct 18 '16 at 13:25
1

Have a look at man rsync. The relevant section here is:

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.

So, all you need is to add the --copy-links option:

rsync -avzhe ssh --progress --copy-links root@ecash-staging:/to/path/file /path/
  • 1
    As a complement, I would like to add that many tools have options that determine how they act when encountering symbolic links (like find for example). Those are usually documented in their man page, so man <tool> is helpful most of the time for that matter. – Valentin B. Oct 18 '16 at 14:18
  • @terdon thanks . --copy-links worked for me – Waqas Rana Oct 19 '16 at 6:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.