Stephen Liu wrote:
tar zcv folderToBeTarred | ssh [EMAIL PROTECTED] "cd /dir ; tar zxv"

It works.


What will be the command for another way round.

If, on MachineA, to tar a folder on MachineB, send the tarball via SSH to MachineA and untar it on select folder automatically.

Is it;
$ ssh -X [EMAIL PROTECTED]/path/to/folder | tar zcf "cd /user:MachineA/path/to/folder tar zxf"

Interesting guess, but far from correct.


-X is really irrelevant, as we're not doing anything X11 oriented.
ssh is simply being used to run a command (tar), on the remote machine. It will forward any output of the program we run, accross the network, to the local machine (so in this case, the output of tar).


So:

ssh [EMAIL PROTECTED] "cd /path/to/folder ; tar zc ." | tar zxx

Almost the exact opposite of the command to copy from local to remote. The | joins two commands, piping the output of one, to the input of another. ssh and tar happily send data to and from each other, with ssh acting as the go-between.

MAL


-- [EMAIL PROTECTED] mailing list



Reply via email to