Duplicate Directory with SSH

How can i duplicate a directory on my server via ssh?


Solution 1:

cp -r directory_name destination
  -R, -r, --recursive
          copy directories recursively

... or maybe you want to exchange folders between hosts. Than you should use rsync

rsync -vaz --rsh="ssh -l username" ~/bk targetHost:~/test

Solution 2:

tar also would be a candidate for this job:

tar cf - . | ssh user@host 'cd /$destination && tar xBf -'

Solution 3:

You could do this with either rsync or scp, both of which go over ssh.

scp -rp directory remotehost:/path/to/directory

rsync -azv -e ssh directory/ remotehost:/path/to/directory