Quantcast
Viewing latest article 4
Browse Latest Browse All 4

scp and compress at the same time, no intermediate save

What is the canonical way to:

  • scp a file to a remote location
  • compress the file in transit (tar or not, single file or whole folder, 7za or something else even more efficient)
  • do the above without saving intermediate files

I am familiar with shell pipes like this:

tar cf - MyBackups | 7za a -si -mx=9 -ms=on MyBackups.tar.7z

essentially:

  • rolling a whole folder into a single tar
  • pass data through stdout to stdin of the compressing program
  • apply aggressive compression

What's the best way to do this over an ssh link, with the file landing on the remote filesystem?


I prefer not to sshfs mount.


This, does not work:

scp <(tar cvf - MyBackups | 7za a -si -mx=9 -so) localhost:/tmp/tmp.tar.7z

because:

/dev/fd/63: not a regular file

Viewing latest article 4
Browse Latest Browse All 4

Trending Articles