1. Copy local File to remote computer
scp local-file.txt remote_username@10.10.0.2:/remote/directory
From the computer which has the source file, go to the command line and, provide the path of the source file followed by scp and then,
username@hostname of the remote computer and then,
the path where you want it to be copied on remote computer.
Another example: Default port number is 22. So we generally use -P in case we have to explicitly specify any port other than 22 like below
scp -P 2000 Downloads/simple2.html pi@raspberrypi.local:~/learning/python/webscraping
Copy local directory to remote computer
scp -r localDirectory user@remotecomp:/path-to-destination
Working example:
scp -r capturing-images pi@raspberrypi.local:/home/pi/Downloads
2. Copy from remote(Pi here) to your local (Mac)
scp user@remote:path-to-file .
Dot at the end means to copy to the current directory of the mac
Working examples: (Run from Mac terminal)
a) Copy img1.jpeg file from remote to current directory of mac
scp pi@raspberrypi.local:~/cam/img1.jpeg .
b) Copy img1.jpeg file from remote to Downloads dir of mac
scp pi@raspberrypi.local:~/cam/img1.jpeg ~/Downloads/