Skip to content

Category Archives: ssh

Using ssh to copy a directory tree from one host to another

From the source host:cd to the parent directory
Use the following command:

tar cf – sourcedir | ssh username@destination "cd destdirparent && tar xf -"
where:
sourcedir is the directory to copy
username is your username on the remote (destination) host
destdirparent is the parent directory on the remote (destination) host