Subscribe

Pipe Directories Over SSH

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’.

Share and Enjoy: These icons link to social bookmarking sites where readers can share and discover new web pages.
  • Technorati
  • Reddit
  • Digg
  • del.icio.us
  • StumbleUpon
  • DZone
  • ThisNext

Related posts:

Trackback URI | Comments RSS

Leave a Reply