Skip to main content
2 of 4
added 49 characters in body
Thor
  • 17.5k
  • 3
  • 55
  • 71

Similar to what jw013 suggested in the comments with separate compression/decompression steps, i.e. combine two ssh commands with a pipe:

compress=gzip decompress=gunzip ssh remote1 "cd srcdir; tar cf - dir | $compress" | \ ssh remote2 "cd destdir; $decompress | tar xvf -" 

Note that the compression/decompression is configurable without depending on the version of tar.

Thor
  • 17.5k
  • 3
  • 55
  • 71