scp and symlinks

Lennart Sorensen lsorense-1wCw9BSqJbv44Nm34jS7GywD8/FfD2ys at public.gmane.org
Mon Aug 16 13:47:02 UTC 2004


On Sun, Aug 15, 2004 at 08:58:57PM -0400, Walter Dnes wrote:
>   Now that I'm back on broadband, I've downloaded the CRUX linux ISO,
> and am setting up my second machine, and moving over a bunch of stuff to
> it.  I prefer to use scp, but tar seems to be necessary to avoid certain
> problems.  E.g. my music collection is in different directories by
> genre.  I also want to sort it by year.  To avoid duplication, I use
> symlinks.  That's fine until I try transferring to the second machine.
> Assuming that directory misc/ exists on the 2nd machine...
> 
> scp -r misc/music waltdnes at machine2:misc/
> 
> ...works.  But misc/music/year/19??, which contain symlinks on the
> source machine end up containing actual files on the target machine.
> I blew away misc/music/ on the target machine and pushed over that
> one directory with...
> 
> tar  -cvf - music/year/ | ssh waltdnes at machine2 'tar -C misc -xvf -'
> 
> ...which is uglier, but at least the symlinks came out as symlinks.  If
> I had used this format originally, I could've pushed over the entire
> music directory properly in the first place.  Is there a way to do it in
> scp that I've overlooked?

There is rsync over ssh, which is much faster at file transfers than
scp, and handles symlinks beautifully, and only copies what is not
already there.  rsync -a source host:destination should do it in
general.  --progress, -v, --partial, --delete, and such are sometimes
useful.  For bidirectional transfer unison does an even better job.

Lennart Sorensen
--
The Toronto Linux Users Group.      Meetings: http://tlug.ss.org
TLUG requests: Linux topics, No HTML, wrap text below 80 columns
How to UNSUBSCRIBE: http://tlug.ss.org/subscribe.shtml





More information about the Legacy mailing list