First, pick up PSFTP (an SFTP client, i.e. general file transfer sessions much like FTP) from here.

Note the following:

6.2.7 The cd and pwd commands: changing the remote working directory

PSFTP maintains a notion of your ‘working directory’ on the server. This is the default directory that other commands will operate on. For example, if you type get filename.dat then PSFTP will look for filename.dat in your remote working directory on the server.

To change your remote working directory, use the cd command. If you don’t provide an argument, cd will return you to your home directory on the server (more precisely, the remote directory you were in at the start of the connection).

To display your current remote working directory, type pwd.

6.2.8 The lcd and lpwd commands: changing the local working directory

As well as having a working directory on the remote server, PSFTP also has a working directory on your local machine (just like any other Windows process). This is the default local directory that other commands will operate on. For example, if you type get filename.dat then PSFTP will save the resulting file as filename.dat in your local working directory.

To change your local working directory, use the lcd command. To display your current local working directory, type lpwd.

6.2.9 The get command: fetch a file from the server

To download a file from the server and store it on your local PC, you use the get command.

In its simplest form, you just use this with a file name:

get myfile.dat

If you want to store the file locally under a different name, specify the local file name after the remote one:

get myfile.dat newname.dat

This will fetch the file on the server called myfile.dat, but will save it to your local machine under the name newname.dat.

To fetch an entire directory recursively, you can use the -r option:

get -r mydir

get -r mydir newname

(If you want to fetch a file whose name starts with a hyphen, you may have to use the -- special argument, which stops get from interpreting anything as a switch after it. For example, ‘get -- -silly-name-’.)

Here’s a useful page on the topic.

This entry was posted on Friday, September 21st, 2007 at 4:28 pm and is filed under Internet/DNS, Web Development. You can follow any responses to this entry through the RSS 2.0 feed. You can leave a response, or trackback from your own site.

One Response to “Transfer Files Over PuTTY”

  1. benny on October 29th, 2007 at 1:34 am

    Hi,

    The title is “Transfer Files Over PuTTY”, but you refer to the program FSFTP. Are the commands discussed in this blogentry the same for putty and FSFTP?

    Thanks.

    /Benny

Leave a Reply