1827294 Members
2986 Online
109960 Solutions
New Discussion

scp and linked files

 
MikeL_4
Super Advisor

scp and linked files

I am using scp -rp to copy a directory structure from one server to another. And it works fine except within the file structure I'm copying ar linked files to directories in the same file system.

When the copy is done it has copied the directory structure, and changed the links to directories and copied them again.

Is there a way to prevent this, or tell scp not to copy linked files ??
3 REPLIES 3
Stephen Keane
Honored Contributor

Re: scp and linked files

scp doesn't understand symbolic links. There are no options (as far as I know) to control the behaviour. The alternative is to archive the files first using tar/cpio/fbackup/whatever and copy the archive across and extract the files from the archive on the far side, or stream the archive across the network.
Florian Heigl (new acc)
Honored Contributor

Re: scp and linked files

You could use rsync for that, it uses ssh as transport and knows about links, or You simply pipe tar through ssh

tar -cf - /origin | ssh remotebox " tar -xvf - "
yesterday I stood at the edge. Today I'm one step ahead.
MikeL_4
Super Advisor

Re: scp and linked files

Thanks