The PuTTY suite includes two programs for copying your files securely between machines. PSCP is a noninteractive program much like scp, and PSFTP is an interactive program inspired by ftp.
PuTTY’s pscp client is for copying files securely between machines, just like scp from OpenSSH and Tectia. Also like scp, pscp is noninteractive. (For an interactive client, see psftp. [18.3.2])
The syntax for PSCP is almost identical to that of scp. [7.5] Remote files are referenced by:
| [user@]host:path |
where user is the remote username, host is the remote hostname, and path is the folder path to the file in question.
PSCP can copy files securely between computers, but the user interface is noninteractive. If you prefer a familiar FTP-like interface, try PSFTP, PuTTY’s interactive file-transfer program. To start a file copying session with remote computer server.example.com, run:
C:\> psftp server.example.com
login as: smith
Using username "smith".
smith@server.example.com's password:
Remote working directory is /home/smith
psftp>The prompt psftp>
indicates that PSFTP is ready to accept commands. If you’re familiar
with FTP, the PSFTP commands will make you feel right at home. To
transfer a file from your local machine to the remote server,
use:
psftp> put myfile
or to copy a local file, myfile, as remote file remotefile:
psftp> put myfile remotefile
This is equivalent to the PSCP command:
C:\> scp myfile server.example.com:remotefile
In the other direction, to transfer files from the remote server to your local machine, use get:
psftp> get remotefile
psftp> get remotefile myfileTo traverse the directory (folder) hierarchy of the remote machine, use the cd command as in DOS or Unix:
psftp> cd my_remote_subfolder
psftp> cd ..To change your working directory on the local machine, use lcd:
psftp> lcd my_local_subfolder
psftp> lcd ..For a full list of commands, type help, or for assistance with a particular command, specify the command name as well (e.g., help put). Table 18-2 lists the available commands. Unfortunately, PSFTP does not include the useful mput and mget commands for transferring many files at once.
Table 18-2. PSFTP commands
Basic commands: | |
open | Open an SFTP connection to a remote server. |
bye, exit, quit | Exit PSFTP. |
help | Get a help message. |
! | Shell escape: run a command-line program on your local computer. |
Directory (folder) commands: | |
dir, ls | List a directory. |
cd | Change directory (remote machine). |
lcd | Change directory (local machine). |
pwd | Print the name of the directory you’re in (remote machine). |
lpwd | Print the name of the directory you’re in (local machine). |
mkdir | Create a directory. |
rmdir | Delete a directory. |
File commands: | |
get | Download a file. |
put | Upload a file. |
reget | Restart a download that you tried previously, but failed; will pick up where the previous download left off. |
reput | Restart an upload that you tried previously, but failed; will pick up where the previous upload left off. |
mv, ren | Rename a file. |
rm, del | Delete a file. |
chmod | Change permissions of a file, like the Unix chmod command. |