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
One Comment
If your tar is GNUish you can save on the ‘cd’ with the C flag.
e.g.
tar cf – sourcedir | ssh username@destination tar xfC – destdirparent
Post a Comment