Easy Way to Move Directory Through SSH

I used to mount my server’s home directory using sshfs to move quite a lot directory from and to my server’s machine. It was then, and this is now :


tar cf - directory_to_move | ssh user@hostname 'cd destination_dir; tar xf - .'

This command will do the same thing as scp but when paired with gzip or bzip you can add a nice compression (gzip or bzip) on the way. The directory structure and permission should be intact thanks to the benefits of tar.

This ssh thing never cease to amaze me.

Advertisements

Leave a comment

Filed under Ilmu, Orang bego punya kegiatan

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s