PuTTY Series: Using PSFTP

26 May 2006

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

1 elwing says...

Be careful when using PSFTP and pscp for large files - large files (>2GB and > 4GB) don't work. The transfer appears to work, but ends up trying to transfer your file very slowly, and never finishes.

Posted at 9:18 p.m. on May 26, 2006


2 Zeth says...

Well that sucks. :( but thanks Elwing for letting us know. :)

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.

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.

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.

Apparently the Windows program HJSplit can also do that, although I have never used it.

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.

Posted at 12:38 a.m. on May 27, 2006


3 António says...

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?

Posted at 10:32 p.m. on January 29, 2007


4 Louis says...

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.

Posted at 11:11 p.m. on June 22, 2007


5 P.Kalidas says...

Hi,

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.

Posted at 6:59 p.m. on April 4, 2009


6 Abhishek Dahnotia says...

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.

Posted at 10:15 a.m. on April 13, 2009


7 Steven says...

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

Posted at 12:28 p.m. on June 7, 2009


8 sreejith says...

I want to download a file from remote server in binary format. Can anyone let me know the command to do so?

Thanks in advance

Posted at 6:23 a.m. on July 3, 2009


9 Manny says...

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?

Posted at 11 p.m. on July 8, 2009


10 Jehzeel Laurente says...

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?

Here's the arrangement of my folders:

home/folder_b/folder_b_1

I hope someone can answer my question. :(

Posted at 12:23 a.m. on August 16, 2009


11 yc says...

Hi Steven,

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.

You may need to open the port 22 from the host machine.

Posted at 9:32 a.m. on September 23, 2009


12 Boopathi says...

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

Posted at 6:10 a.m. on October 1, 2009


13 Bubba says...

Is there any way psftp can return the true transfer rates oberved during the actual transfer?

Posted at 2:56 p.m. on October 18, 2009


14 Manju says...

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.

Posted at 5:09 a.m. on November 4, 2009


What do you have to say?

Show Editing Help

About

Hello, my name is Zeth, I'll be your host here.

Command Line Warriors is about taking control of your own technology, it looks at our experiences of computing; especially using GNU/Linux, the Python programming language, the command-line and issues such as techno-ethics, best practices and whatever is cool now. If you take control of your technology then you are a Warrior too!

This site is your site too which means that you can contribute and get involved. You can leave comments using the facility provided. For me, the comments and discussions are by far the best part of the site. So please do have your say!

Latest Discussions

Zeth

November 29, 2009
Hi Jordan, yes that URL is gone now. I have a new contact form on this site.
Python CGI contact forms

Jordan

November 29, 2009
Zeth attention! Your form, http://zeth.me.uk/contact/, is not working The explorer says connecting ..but nothing happens Sorry for my poor English: I am Spanish Regards
Python CGI contact forms

Jordan

November 26, 2009
Sorry: tell me , not tellme (I'm spaniard) And http://zeth.me.uk/contact/ don't work
You got the touch, you got the power

David Jones

November 25, 2009
Your mad skillz are too l33t! for me. I specifically switched to Google Reader so that I could show people what blogs I read. But I couldn't work out how ...
How to find the fashionable blogs quickly

Brian R. Hickey

November 20, 2009
Symantec picked it up too.
How to bring down Internet Explorer with six words

Zeth

November 17, 2009
Thanks djm, I am the moose here. Christian, assuming one actually does Internationalise the countries, it should still work I guess, as the gettext stuff will happen before the list ...
Countries in Django

Phillip Temple

November 17, 2009
Good start, but: a) wouldn't I want None back rather than 'ZZ'? b) why not add a 'shortcut' boolean, then prepend flagged fields (plus usual '-----' separator) to the actual ...
Countries in Django

djm

November 17, 2009
Am I being a moose or did you mean: from whatever.countries import CountryField instead of from whatever.countries import CharField ? Good post though, cheers.
Countries in Django

Christian Joergensen

November 17, 2009
Wouldn't the ordering get messed up after i18n?
Countries in Django

Steve - Electronic Cigarettes Fan

November 17, 2009
Very well done. Is your blog just you writing? Nicely done, Steven.
Blogger vs Wordpress

vetetix

November 15, 2009
Sorry to bother you nearly two years after you wrote this blog article, but I can't manage to find how to modify an existing field. I am trying to change ...
Three Useful Python Bindings - ClamAV, Apt and Evolution

Manju

November 4, 2009
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. ...
PuTTY Series: Using PSFTP

iki

November 2, 2009
or simpler: socket.gethostbyname_ex(socket.gethostname())[2]
How to find out your IP address in Python

iki

November 2, 2009
local_ip = set([ i[4][0] for i in socket.getaddrinfo(socket.gethostname(), None) if i[0] == 2 ])
How to find out your IP address in Python

Fred

November 2, 2009
testing rst ------------- - point 1
An Introduction to ReStructuredText

Ano

October 27, 2009
"You simply found the license of the StumbleUpon Toolbar for Internet Explorer." That's possible. I've got some more interesting information to add. Firstly, go to this page: https://addons.mozilla.org/en-US/firefox/addon/138 - this ...
Are your Firefox extensions proprietary software?

Ken

October 21, 2009
Stumbled in here at lunch. This is the best find of the week. Thanks.
Three classic command line tips

Jim

October 19, 2009
Thanks for the rtsp:// post - that's something that has been bugging me for a while!
Three classic command line tips

Zeth

October 18, 2009
Thanks for the comments guys. Great to see the all the gang are still here!
Three classic command line tips

Bubba

October 18, 2009
Is there any way psftp can return the true transfer rates oberved during the actual transfer?
PuTTY Series: Using PSFTP