rsync is a very useful alternative to rcp and scp. It tool lets you copy files and directories between a local host and a remote host. The main advantage of using rsync is that rsync can use SSH as a secure channel, send/receive only the bytes inside files that changed since the last replication, and remove files on the destination host if those files were deleted on the source host to keep both hosts in sync.

rsync -avz -e ssh user@host1.com:/~mydir ~/

This copies mydir and its contents from user1 to local

rsync -avz -e ssh user@host1.com:/~mydir/ ~/

This copies only contents of mydir from user1 to local. The only different between the two is a trailing slash.

By master