If you want to copy the soft link itself instead of the actual file, you can use -P
the option of the scp command. This option tells the scp command to preserve soft links instead of following them and copying the actual files. Here is an example:
scp -r -P /path/to/source user@remote:/path/to/destination
Among them, -r
the option is used to recursively copy the directory, -P
the option is used to retain the soft link, /path/to/source
is the path of the source file or directory, user@remote:/path/to/destination
is the target path, where user
is the user name of the remote host, remote
is the IP address or host name of the remote host, and /path/to/destination
is the target path.
Note that if you -P
copy a soft link using the option, the soft link on the target path will point to the original link's path, not the actual file's path. If you need to use actual files instead of soft links on the target system, you should use -L
the option to follow the soft links and copy the actual files.