SCP (copy) folder/file from server to local

Anyone who has tried to update their local box or moved sites to a different server will notice that it’s just not updating the database that is required. In my most recent scenarios, I’m trying to pull a fresh copy of a staging to my local and I’m missing all the uploads so it still looks weird.

You could use a FTP program like FileZilla (which I used to do) or or use SSH and with just one line, you can copy a folder or single file to your desktop. Doing it this way is a LOT faster if you have a large folder with images. 

All you need to do is know the path on the server to the folder/file you want to copy over. The line is incredibly simple:

$ scp -r user@hostIP:/path/to/folder ~/desktop/

This will copy the folder from the path you first provided to the desktop. If you want to do just a file….

$ scp user@hostIP:/path/to/folder/pic.jpg ~/desktop/

Remember to leave the -r on this one. This will copy pic.jpg to the desktop. It might be faster just to copy a file over with FileZilla, but it’s still neat to have the option. 🙂

Leave a Reply

Your email address will not be published. Required fields are marked *