'tar cz folder/ | ssh server "tar xz"'
Can be pulled off with two flags to scp - and you get to see progress as a benefit! scp -Cr folder server:dest/ 'tar cz folder/ | ssh server "tar xz"'
Can be pulled off with two flags to scp - and you get to see progress as a benefit! scp -Cr folder server:dest/You will also get better compression with tar (or rsync), as it is compressing the files directly, and not just the ssh stream (-C is just passed on to ssh).
I did the tests years ago, but a quick google found someone who tried to test the various combinations: http://www.spikelab.org/transfer-largedata-scp-tarssh-tarnc-...
On the receiving machine, in its destination directory:
nc -l 6789 | tar xvf -
And on the sending machine, from its source directory: tar cvf - . | nc receiving-machine 6789
netcat varies a bit from distro to distro, so you may need to adjust these command lines a bit to get it to work.If it doesn't know how many bytes there will be, it just gives you a "throbber" (which is better than nothing, though).
cat file | pv | nc ...
and gzip < file | pv | nc ...
and so forth will result in a throbber as it can't query the pipe for a length.If you demoggify the first example to:
pv file | nc ...
you get a progress bar on the sending end without manually specifying a size.Even without a proper % progress bar, the display can be useful as you can at least see the total sent so far (so if you know the approximate final size you can judge completeness in your head) and the current rate (so you can see it is progressing as expected (so you get some indication of a problem such as an unexpectedly slow network connection, other than it taking too long)).
scp won't copy certain file types correctly. Rsync really is better here, and not just because of that.
I'm not aware of any attributes that tar doesn't preserve.
Also, I find that if I'm going to copy the data once, I'm often going to copy it twice, or which to get a more up to date version of it at a later time. Rsync clearly wins in these cases.
Finally, from the compress flag on rsync: Note that this option typically achieves better compression ratios than can be achieved by using a compressing remote shell or a compressing transport because it takes advantage of the implicit information in the matching data blocks that are not explicitly sent over the connection.
Remember: Rsync trades CPU and disk i/o (lots of disk i/o) for network bandwidth.
In the pathological case "thousands of tiny files over a fast network" it can easily be orders of magnitude slower than a straight tar.