gcbenison
gcbenison

Reputation: 11963

Copy the symlink as a symlink, _and_ its referant

Let's say I have on host A:

/foo/afile -> /bar/afile

Now on host B, the result of:

rsync -l hostA:/foo/afile /foo

is a broken symlink in /foo/afile, and the result of:

rsync -L hostA:/foo/afile /foo

is a regular file /foo/afile.

What's a good way to run rsync from host B, ending up with /foo/afile -> /bar/afile on host B? Can it be made to work even if host B has no advance knowledge of the path /bar?

Upvotes: 0

Views: 179

Answers (1)

Daniel Schlaug
Daniel Schlaug

Reputation: 1514

As described in this Mac OS X Hint you could make the symlink relative to the current path. Something like

cd /foo
ln -s ../bar/afile ./afile

Upvotes: 1

Related Questions