0

I have a large amount of data to copy to a new server. On the current server there are a number of symlinked directories which I would like transformed to real directories on the new server.

For example, I have /foo/bar --> /other/place on the old server but I would like to have all data under /other/place located in /newfoo/bar on the new server. (Yes the top level directory is changing its name as well...)

Using rsync I have tried -L, -l, -K, -k and various combinations and permutations but nothing seems to result in the transformation I require.

All thoughts gratefully received.

1 Answers1

0

I have experimented a bit and there is a way to copy files that are linked from symlink folder to folder on new server. Try this:

rsync --copy-dirlinks -avP -e ssh /foo/bar/ root@newserver:/newfoo/bar/

Rsync wil copy files from symlink path /ortther/place to /newfoo/bar on target server.

RonanW.
  • 429
  • 2
  • 7
  • Worked OK I think until it found /foo/bar/src/src --> /foo/bar/src which started a nice recursion. :-) – Michael Lightfoot Aug 08 '16 at 23:49
  • Your solution unfortunately does not work (and none will I contend) because there are also internal symlinks such as /foo/bar/thing/someplace --> /foo/bar/someplace and other like complexities. – Michael Lightfoot Aug 09 '16 at 00:16
  • What are you trying to accomplish here? Do you want to rsync symlinks linking outside of /foo/bar as files and keep simlinks that are linking inside of /foo/bar or you want to rsync all symlinks to files on new server? – RonanW. Aug 09 '16 at 08:03