On the road again

Recursive scp and symlinks.

To copy recursively with scp, you use scp -r.
The thing is that if you have symlinks in your directory the content of the directory being pointed to by the symlinks will be copied, this is not necessarily what you want (the symlink will be followed instead of being preserved).
Scp have no option to specify that you don’t want to follow symlinks.
If you want to preserver symlinks, you should use rsync:


rsync -avz -e ssh /src/dir Ця електронна адреса захищена від спам-ботів. Вам необхідно увімкнути JavaScript, щоб побачити її.:dst/dir

Be carefull, if you preserve symlinks, the newly created symlinks on the remote server can point to a non existant path.

Add comment