PuTTY Series: Using PSFTP

PSFTP is a nice little program that allows you to upload files from your local Windows machine to another machine such as a remote GNU/Linux/BSD/Unix/Mac OS X server.

It uses the SSH File Transfer Protocol - SFTP, (this has nothing to do with FTP), and can provide secure file transfer over a network.

Starting PSFTP

You start PSFTP by clicking on its option in the PuTTY folder in the start menu.

When you start PSFTP you will see a prompt like this:

psftp>

Connecting to a remote machine

To start a session use the open command, this can be a hostname or an IP Address, so:

open username@host.net

open warrior@google.com

open warrior@192.168.0.99

Moving files

To move a file to the server use the put command, for example:

put image.png

To retrieve a file from the server down to the local machine, use the get command:

get image.png

That is all you really need to know. There are lots of other commands, but because PSFTP is not very forgiving of typing mistakes, I personally find it easier to move files around on the remote server using PuTTY rather than PSFTP.

However for moving files between Windows and a GNU/Linux/Unix machine, PSFTP works really well. However if you do want to know more commands then I have reproduced the program's in-line help below.

PSFTP - command reference

! run a local command

bye finish your SFTP session

cd change your remote working directory

chmod change file permissions and modes

close finish your SFTP session but do not quit PSFTP

del delete files on the remote server

dir list remote files

exit finish your SFTP session

get download a file from the server to your local machine

help give help

lcd change local working directory

lpwd print local working directory

ls list remote files

mget download multiple files at once

mkdir create directories on the remote server

mput upload multiple files at once

mv move or rename file(s) on the remote server

open connect to a host

put upload a file from your local machine to the server

pwd print your remote working directory

quit finish your SFTP session

reget continue downloading files

ren move or rename file(s) on the remote server

reput continue uploading files

rm delete files on the remote server

rmdir remove directories on the remote server

16 thoughts on “PuTTY Series: Using PSFTP

  1. <p>Be careful when using PSFTP and pscp for large files - <a class="reference external" href="http://www.chiark.greenend.org.uk/~sgtatham/putty/wishlist/large-files.html">large files (&gt;2GB and
    &gt; 4GB) don't work</a>. The transfer appears to work, but ends up trying to
    transfer your file very slowly, and never finishes.</p>

  2. <p>Well that sucks. <img src="/static/forum/img/smilies/sad.png"> but thanks Elwing for letting us know. <img src="/static/forum/img/smilies/smile.png"></p>
    <p>I have moved very large files indeed with normal Linux scp on a LAN between
    two Linux boxes. So in this case it is either Windows or PuTTY that is the
    limiting factor.</p>
    <p>I assume it is PuTTY here, but in its defence, I know the theoretical maximum
    of file-size for Windows used to be 4GB. The real size was often much lower.
    Even when using NTFS, Windows XP's support for large files is still a bit of
    a curate's egg.</p>
    <p>I would consider splitting the file into chunks before sending it across. The
    Linux/Unix command lxsplit can split files into chunks, as can the graphical
    Linux program gtk-splitter.</p>
    <p>Apparently the Windows program HJSplit can also do that, although I have
    never used it.</p>
    <p>You could also just use good old bittorrent to send such large stuff across.
    The advantage of BT is that it would also be checksummed along the way so you
    know that all the King's men have put humpty-dumpy back together correctly.</p>

  3. <p>I have a problem when I try to use PSFTP with a file with this name
    'test:yup.xml' for example, PSFTP does not like ':' and I can't rn the file.
    Can you help me?</p>

  4. <p>Hello, i will like to know if a zip file for example .zip can be uploaded in
    the server via putty and also can it be unzip if it can be uploaded.
    Please if this is possible, whats the command to unzip and unrar.</p>

  5. <p>Hi,</p>
    <p>In Psftp file transfered in Binary mode.How to transfer file in ASCII mode.
    We have a option in SFTP to transfer the file in Binary or ASCII.</p>

  6. <p>I am using PUTTY .58 version. i am trying to send file through the Web Application. The application is hosted on a server and same server having PSFTP.exe. the problem is that if i logged in in the application server, i can able to send the file, but if i logged off to the server i am not able to send file by browser of my machine.</p>

  7. <p>when I bring up the psftp and open to a host as soon as I hit the enter key my command line window disappears.</p>

  8. <p>I want to download a file from remote server in binary format. Can anyone let me know the command to do so?</p>
    <p>Thanks in advance</p>

  9. <p>I keep entering the put index.html command but it wont open it. And yes, it's saved as a text document onto my desktop. How do I fix this problem?</p>

  10. <p>btw, how can I move all files at once? For instance i have several files at folder B 1 and I want to move all of the files from folder_b_1 to folder_b? How can I do that in putty?</p>
    <p>Here's the arrangement of my folders:</p>
    <p>home/folder_b/folder_b_1</p>
    <p>I hope someone can answer my question. <img src="/static/forum/img/smilies/sad.png"></p>

  11. <p>Hi Steven,</p>
    <p>I've encountered similar problem like yours before, it was because of the host did not open port 22 for your machine where you're accessing the sftp.</p>
    <p>You may need to open the port 22 from the host machine.</p>

  12. <p>If any possible way to get the latest file(using date and time stamp) present in the folder of SFTP.</p>

  13. <p>I am transferring some files using psftp to other device's FAT partition. But the filestamp of the file being transferred is modified to that of FAT device, after the transfer. Is psftp creates a new file and copy the contents of the original file? I wanted, the file to be copied as it is, including with the date time. Any help is greatly appreciated.</p>

  14. <p>I'm having problem about setting date in creating batch command. In DOS batch command, command as usual is 'set a_date=%date%' , but how realize in psftp batch command ?</p>
    <p>Thank's in advance.</p>

  15. <p>Hey... I can't do an lls or ldir with sftp what's the equivalent command for listing files in the LOCAL directory.</p>
    <p>kgr8thx
    QC</p>

How about Global Thermonuclear War? Wouldn't you prefer a good game of chess? Powered by zpress