How to gzip a directory, transfer via scp, and decompress in one command

command linegziprsyncscp

I frequently transfer large directories over scp and it would be sweet if I could somehow compress the directory, send it, and decompress it all in one.

Is something like this possible?

Best Answer

How about using rsync instead with the -z option enabled for compression?

rsync -az --progress source_dir/* remote_host:/destination_dir

This also has the added benefit that if the file already exists and has not changed on the destination, it will not be transferred.