I am attempting to untar multiple tar files over ssh:
ssh user@hostname "cat /dir/file*.tgz" | tar xvzf -
The above only works on the first file match on the remote server. The local (dest) server only receives one file. The wildcard has been verified to match multiple files though.
Is there another way to do this?
(Edit after first try didn’t work:)
Another idea, avoiding multiple
sshcalls and alsoscp(since this needs at least one roundtrip between each file):We use one more
tarcall on the server side to wrap all the files together, a secondtarcall on the client side to unwrap them again, which will then be callingtar xzvfor each entry once. This works similar to the base64-answer from sehe, but will be more efficient since it does not blow up the files.