How to upload and download files through SSH using PuTTY
As well as for executing commands SSH can also be used to transfer files between your local computer and your hosting account. To do this first you need to download and install the PuTTY installation package and have a working SSH connection to your account. To learn more on how to do this read the tutorial on connecting to your account through SSH via PuTTY.
The PuTTY installation package contains the PuTTY application itself and a few other applications. The ones used for transferring files are PSCP and PSFTP. They both use SFTP (SSH File Transfer Protocol) to transfer files through SSH; PSCP can also use the older protocol SCP (Secure Copy). They are both command line applications which means that they have be to launched and used through Windows Command Prompt. The main difference between them is that PSCP can be used only for file transferring while PSFTP can also be used to browse the folders on your hosting account, delete files and folders, etc.
Before you can connect to your account and transfer files you have to open Pageant (one of the applications that comes with the PuTTY installation package) and add your private SSH key. After you start your Windows Command Prompt (Start button>Run>type cmd>OK) type the following command to add PSCP and PSFTP to the system path, and press Enter: set path=%path%;d:\putty. The command is valid if the PuTTY installation package is installed in a folder called putty on your local D drive. Just change the path to point to your PuTTY folder.
To start PSCP you don't need to do anything else, you can directly execute commands. An example command with which you can upload a file from your local computer to your account is: pscp d:\documents\example.txt firstname.lastname@example.org:/home/username/public_html. This command will upload a file called example.txt from the documents folder on your local D drive to the public_html directory on your account. You have to replace username in both places with your actual username and, if needed, the server name. The command for downloading is the same. You only need to put the path to the file on your account first and then the path on your local computer: pscp email@example.com:/home/username/public_html/example.txt d:\documents. To transfer a whole directory together with the subdirectories just add the -r option to the command: e.g. pscp -r firstname.lastname@example.org:/home/username/public_html/exampledirectory d:\documents.
To start PSFTP, after you execute the set path command type psftp email@example.com (e.g. firstname.lastname@example.org). The commands for uploading and downloading are not the same as the PSCP commands. You can download files with the get command. The simplest form of the command looks like this: get examplefile.txt. This command will download the file examplefile.txt from the current working directory on your account to the current working directory on your local computer. The working directory on your account can be changed with the command cd (e.g. cd public_html) and the working directory on your local computer with lcd (e.g. lcd d:\documents). Files can be uploaded with the put command: put examplefile.txt. This command will upload a file called examplefile.txt from the working directory on your local computer to the working directory on your account. You can add the -r option to both commands to transfer directories. You can also use the mget and mput commands to transfer multiple files (or directories with the -r option added) at once.
For more information and examples read the tutorial on transferring files through SSH (for Windows users).