How to copy a folder on a remote server with SSH
The best tool for this task is rsync , allowing incremental transfer and compression. Use the following command: rsync -avz user@host:/remote/folder/ /local/dir If you need to specify SSH connection details, like port and key file: rsync -avz -e "ssh -p 2222 -i ~/.ssh/mykey" user@