1

I wondered if there's an easy way to copy, scp, pipe tar, etc. host1:/base1/dir1 to host2:/base2/dir1. Other than the base directory, all the directory structure should be identical.

`host1:/base1/dir1/dir2/dir3/dir4/ contains a symbolic link file like this:

SYMBOLIC_LINK -> /base1/dir1/dir2/dir5/dir6/file1

I want the copy to have a symbolic link pointed to the same directory names, but with a different base directory:

SYMBOLIC_LINK -> /base2/dir1/dir2/dir5/dir6/file1

I'd like to do that on the fly without having to so some kind of sed or other search and replace to fix it after the copy.

  • Did you have a look at rsync? It can copy across hosts (via ssh) and has many options regarding smlinks. Search the manpage for "link", maybe there are some that help you do what you want. – Lucas May 23 '16 at 23:23
  • I have not yet Lucas. I was hoping somebody had done this or similar before and had a quick answer. I will research rsync options though. Thanks. Wonder why I didn't get an email notification that you posted. – Jeff_linux May 24 '16 at 10:48

Your Answer

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

Browse other questions tagged or ask your own question.