Skip to main content

Your proposed answer:

ssh -n REMOTEHOST 'tar zcvf - DIRTOCOPY' | localZip.tar.gz

did not work for me - the pipe to a file failed.

I did this instead and it worked:

ssh -n REMOTEHOST 'tar zcvf - DIRTOCOPY' | cat - > localZip.tar.gz

Pipe it to 'cat' via standard input and redirect the output to the file.

another solution would be to remove the "| cat -" and just send the SSH output directly to the tarball:

ssh -n REMOTEHOST 'tar zcvf - DIRTOCOPY' > localZip.tar.gz

Your proposed answer:

ssh -n REMOTEHOST 'tar zcvf - DIRTOCOPY' | localZip.tar.gz

did not work for me - the pipe to a file failed.

I did this instead and it worked:

ssh -n REMOTEHOST 'tar zcvf - DIRTOCOPY' | cat - > localZip.tar.gz

Pipe it to 'cat' via standard input and redirect the output to the file.

Your proposed answer:

ssh -n REMOTEHOST 'tar zcvf - DIRTOCOPY' | localZip.tar.gz

did not work for me - the pipe to a file failed.

I did this instead and it worked:

ssh -n REMOTEHOST 'tar zcvf - DIRTOCOPY' | cat - > localZip.tar.gz

Pipe it to 'cat' via standard input and redirect the output to the file.

another solution would be to remove the "| cat -" and just send the SSH output directly to the tarball:

ssh -n REMOTEHOST 'tar zcvf - DIRTOCOPY' > localZip.tar.gz
Source Link

Your proposed answer:

ssh -n REMOTEHOST 'tar zcvf - DIRTOCOPY' | localZip.tar.gz

did not work for me - the pipe to a file failed.

I did this instead and it worked:

ssh -n REMOTEHOST 'tar zcvf - DIRTOCOPY' | cat - > localZip.tar.gz

Pipe it to 'cat' via standard input and redirect the output to the file.