Problem and limitation of «scp»
While transferring or downloading files and folders between different Unix systems including macOS, the scp
-command («secure copy») is very handy.
scp -r myuser@server.com:"backup/" ~/Downloads/
However, there is a major downside for large or multiple file transfers:
- scp does not support to continue a disrupted transfer.
With scp you’ll keep replacing an existing file/folder download – or start from scratch…
But there is a neat, and almost as simple, solution that support continuous progress:
- using
rsync
Secure and continuous remote file transfers using «rsync» on macOS
Solution: in order to download for example a remote folder with all files to the local Downloads-folder in macOS Finder, the following rsync
-command can be used:
rsync -e ssh --ignore-existing --progress -r myuser@server.com:"backup/" ~/Downloads/
-e ssh
= force using ssh with rsync--ignore-existing
= do not transfer/modify files previously transferred--progress
= display a progress bar for each copy job-r
= copy the remote folder recursively (with all contained files)
Continue after an interruption
When the download fails / is disrupted, just use the same command again & rsync
will continue downloading where it last was interrupted.
Merge files of different folders locally using «rsync»
When you have folders whose files need to be merged, rsync
is also very handy.
Read more about this in my previous post
«How to merge two folders in macOS using rsync in Terminal.app».