0

We are currently using "rsync" to copy a directory recursively. We are moving to a newer platform where "rsync" is not available and have been advised to use "cp" instead. We use the below options in "rsync".

rsync -ak --safe-links src dest

-k --> transforms and copies dir symlinks in source as dir in target

--safe-links --> ignores symlinks that point outside the source tree

We have file symlinks as well within the source tree which we want to retain in the target to avoid bloating the size.

We can manage without an alternative for the "--safe-links" option. I checked the options in the "cp" command and am not able to find anything that matches the "-k" option of rsync. I tried the below options:

cp -rh cp -rd cp -rH

But all of them either dereference both file & dir symlinks or retain both of them.

Is there a way to achieve the "-k" option of "rsync" in "cp"? If not "cp", is there any other utility that provides a similar functionality? I want to avoid having to write a custom script just for this copy.

Thanks.

AnR
  • 1
  • 1
  • 2
    I suppose the obvious "ask the provider to install rsync" isn't an option? (Make sure they know they don't need to install the rsync service daemon.) You know that if you've got command-line access to the remote system you can install a local copy of rsync in your own directory. See [Is it possible to install rsync without sudo?](https://unix.stackexchange.com/a/646964/100397) for an example solution – roaima Feb 22 '23 at 09:07

0 Answers0