Web Hosting Philippines, Offshore Programming, Offshore SEO Philippines, Cheap Webhosting Manila Philippines
Home -> Resources -> Linux -> Copying directories across servers while preserving symbolic links

Copy directories (via ssh) across servers while retaining symbolic links

Using sftp or scp to copy directories and files across servers via the SSH protocol will fail to copy symbolic links along with the other files. sftp will happily ignore symbolic links, while scp does follow the symbolic link but creates a file in place rather than replicating the link. Neither behavior is what you usually want to happen and there is no option to make either do the right thing, which would be to just replicate symbolic links. Annoying, isn't it??

Happily, there is a way to accomplish this task correctly. For this, you need to use rsync. The command to run will be

rsync -azuv -e ssh  <user>@<serveraddress>:<sourcedirectory> <destinationdirectory>

An additional benefit to using rsync is that the copying seems to go much much faster compared to sftp/scp.

 Want to tip via bitcoin?

(address string below for double checking)

Back to Top

© 2012 by Andy Sy
last updated: 2012-Jan-9

Web Development / Rich Internet Applications (RIA) Development

Programming Languages


Database Development

   © 2003-2015 Neotitans Technologies Inc.