How To Use PSCP Command On Windows? – POFTUT

How To Use PSCP Command On Windows?


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.

Download Pscp

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.

https://www.chiark.greenend.org.uk/~sgtatham/putty/latest.html

Download Pscp
Download Pscp

As we can see there is 32 and 64 bit versions. I will use 64 bit because my Windows is 64 bit.

Install Pscp

We will install the downloaded putty 64 bit msi package regular Windows Next->Next style like below.

Install Pscp
Install Pscp

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.

> pscp
Help and Options
Help and Options

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 Options: part.

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 ismail@192.168.142.144:/home/ismail/pass pass.txt
Download or Get File From Remote Server
Download or Get File From Remote Server

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.

LEARN MORE  SSH Tutorial With Command Examples

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 /home/ismail . . means we will save to the current working directory.

> pscp ismail@192.168.142.144:/home/ismail/*.gz .
Download or Get Multiple Files From Remote Server
Download or Get Multiple Files From Remote Server

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 ismail@192.168.142.144:/home/ismail/pass.txt
Upload or Put File To Remote Server
Upload or Put File To Remote Server

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 pass.txt, config.sys to the remote server.

pscp  FILE1 FILE2 ... FILEN  USER@IPADDRESS:/PATH/FILE
> pscp pass.txt config.sys  ismail@192.168.142.144:/home/ismail/
Upload or Put Files To Remote Server
Upload or Put Files To Remote Server

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 -r.

> pscp -r ismail@192.168.142.144:/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 -r option.

> pscp -r Downloads ismail@192.168.142.144:/home/ismail/Downloads/

We will put local directory  name Downloads to the remote server 192.168.142.144 and folder /home/ismail/Downloads

Leave a Comment