
Book IV
Chapter 5
Using FTP
357
Using an FTP Command Line Client
The files that I want to download are located in the pics subdirectory, so
the next command to issue is cd pics. This results in the following output:
250 CWD command successful.
ftp>
Once again, the command’s output isn’t exactly what you’d expect. The FTP
protocol doesn’t actually have a CD command. Instead, it uses a command
named CWD, which stands for change working directory, to change the directory.
The Windows FTP client uses command CD instead of CWD to be more
consistent with the Windows/MS-DOS user interface, which uses the command
CD to change directories. When you type a CD command at the ftp> prompt,
the FTP client sends a CWD command to the FTP server. The server then
replies with the message CWD command successful to indicate that the
directory has been changed.
Next, type dir again. The FTP server displays the directory listing for the
pics directory:
200 PORT command successful.
150 Opening ASCII mode data connection for /bin/ls.
06-27-07 10:04PM 123126 door.jpg
06-27-07 10:06PM 112457 echair.jpg
06-27-07 10:06PM 81610 fence.jpg
06-27-07 10:09PM 138102 fog.jpg
06-27-07 10:09PM 83712 gallows.jpg
06-27-07 10:10PM 166741 ghost.jpg
06-27-07 09:58PM 119859 skel01.jpg
06-27-07 10:05PM 87720 wall.jpg
226 Transfer complete.
ftp: 400 bytes received in 0.00Seconds 400000.00Kbytes/sec.
ftp>
Here, you can see that the pics directory contains eight files. To download
a file, you use the GET command, specifying the name of the file that you
want to download. For example, to download the door.jpg file, type get
door.jpg. The FTP server transfers the file to your computer and displays
the following response:
200 PORT command successful.
150 Opening ASCII mode data connection for door.jpg(123126 bytes).
226 Transfer complete.
ftp: 123126 bytes received in 0.13Seconds 985.01Kbytes/sec.
ftp>
Notice again that the response indicates that the command actually processed
by the server is a PORT command. The file is transferred in ASCII mode.
The entire transfer takes 0.13 seconds, which works out to a transfer rate of
about 985K per second.
After you download the file, you can end the session by typing bye. FTP
responds by displaying the site’s goodbye message; then it returns you to
the MS-DOS command prompt:
34_625873-bk04ch05.indd 35734_625873-bk04ch05.indd 357 9/21/10 10:31 PM9/21/10 10:31 PM