How do I use scp to copy a folder from remote to local?

I remember struggling with this exact thing when setting up automated backups.

One important tip: always make sure the remote path is absolute or that your shell can resolve it correctly.

I usually write it like this:

bash
Copy
Edit
scp -r "user@192.168.1.100:/home/user/foo" ~/Desktop/
Quoting the remote path avoids issues with spaces or weird characters, and using ~ locally saves time. Also, if your folder is huge or the connection isn't great, consider combining it with -C to enable compression:

bash
Copy
Edit
scp -rC user@remote:/path/to/foo ~/Desktop/

That’s shaved a few minutes off big transfers for me. Try it out!