Why does the
scp command not copy links from the local computer to the other?
scp -rp dir linux:/dir_target
How can I copy the links when in the source directory I have both files and links?
If I understand what you want correctly. You want to exactly mirror dir on the local machine to dir_target on linux, and it is copying the contents of the symlink, rather than copy the symlink itself. To make an exact duplicate, you need to use rsync instead of scp.
I suspect that will have the desired result. I generally use rsync anyway because it will only copy files that need to be copied, and generally is more intelligent than scp.
This is a good question. Unfortunately, scp does not copy symlinks, and it looks as if there are no plans to add it: https://bugzilla.mindrot.org/show_bug.cgi?id=485.
However, alternatives do exist. You could: