Migrate website content using ssh + tar (quick and easy)
There are times when you cannot create an intermediate tarball when moving your website due to lack of disk space. There are other times when you wanna be smart
To copy a remote directory to a local directory use:
On your local machine, on the terminal
cd /my/local/directory/where/i/want/to/untar/files
On your local machine, on the terminal
(ssh remoteuser@remotemachine "cd /path/to/remote/directory/i/wish/to/copy; tar cpf - ./") | tar xpf -
To copy a remote directory to a remote directory on some other machine use:
On your destination remote machine, on the terminal
mkdir -p /my/remote/directory/where/i/want/to/untar/files
On your local machine, on the terminal
(ssh sourceremoteuser@sourceremotemachine "cd /path/to/remote/directory/i/wish/to/copy; tar cpf - ./") | (ssh sourceremoteuser@sourceremotemachine "cd /my/remote/directory/where/i/want/to/untar/files; tar xpf -")