remote copy files using ssh and tar

to copy a whole directory from this server to another do:

To push files:

cd /dir/to/copy/from; tar zpcf – * | ssh otherserver “(cd /dir/to/copy/to && tar zxvpf – )”

To pull files:

ssh -C otherserver '(cd /some/dir && tar zcf - *)' | (cd /dest/dir && tar zxf -)

Leave a Reply

Your email address will not be published. Required fields are marked *