Pipe Directories Over SSH
January 12th, 2008 by proj
My good friend Jayk showed me this nifty trick years ago for moving directories over ssh:
From a local directory to a remote directory:
tar -zcf - . | ssh name@host "tar -zvxf - -C <destination directory>"
From a remote directory to a local directory:
ssh name@host "tar -zcf - -C <source directory> ." | tar -zvxf -
This works by causing tar to read from stdin or write to stdout “-f -” and piping the results through ssh using the ‘execute command over ssh’.
Related posts:






