pscp command is an SCP protocol implementation where we can transfer and copy files and folders securely over a network with the SSH connection. In this tutorial, we will learn how to install and use pscp tool on Windows operating system.
pscp command can be downloaded from the following link. There are different installation types.
pscp can be installed in standalone or with the putty installer package. I prefer Putty installation package where path environment configuration also done automatically.
As we can see there is 32 and 64 bit versions. I will use 64 bit because my Windows is 64 bit.
We will install the downloaded putty 64 bit msi package regular Windows Next->Next style like below.
Help and Options
If we need to list all available options and help information we can just issue
pscp command to the command line or MSDOS like below.
We can see that the usage or syntax of the
pscp command is provided the start of the help information. Also, all available options are printed after the
Download or Get File From Remote Server
We will start with a simple example where we will download or get a single file from a remote server or system. As stated previously we will use SSH protocol for connection and transfer. We will just provide the remote system user name, IP address or hostname and the file with its absolute path. We will also provide the file name we want to save locally.
pscp USER@IPADDRESS:/PATH/FILE FILE
> pscp firstname.lastname@example.org:/home/ismail/pass pass.txt
We can see that for the first time we will connect a server we need to approve the remote server puıblic key. Then we provide the password for the user
ismail. After we authenticated successfully the transfer of the file is completed successfully.
Download or Get Multiple Files From Remote Server
In the previous example, we have downloaded or got a single file from the remote server. We can also download and get multiple files from a remote system according to their path or file extension.
In this example we will download all
gzipped file with the
gz extension those resides
. means we will save to the current working directory.
> pscp email@example.com:/home/ismail/*.gz .
Upload or Put File To Remote Server
We can also upload or put given file to the remote SSH server with the
pscp command. We will first provide the file name and then provide the remote system user name, IP address or Host name and the path we want to put.
pscp FILE USER@IPADDRESS:/PATH/FILE
> pscp pass.txt firstname.lastname@example.org:/home/ismail/pass.txt
Upload or Put Files To Remote Server
We can also put multiple files to the remote server with
pscp command. We will provide the file names before the remote server, user information. In this example, we will copy local files
config.sys to the remote server.
pscp FILE1 FILE2 ... FILEN USER@IPADDRESS:/PATH/FILE
> pscp pass.txt config.sys email@example.com:/home/ismail/
Download or Get Directories Recursively From Remote Server
If we want to get remote directories and download local we need to use recursive options which is
> pscp -r firstname.lastname@example.org:/home/ismail/ .
Upload or Put Directories Recursively To Remote Server
We can also send or upload local directories to the remote server. We will again use the
> pscp -r Downloads email@example.com:/home/ismail/Downloads/
We will put local directory name
Downloads to the remote server
192.168.142.144 and folder