Working with FTP


File Transfer Protocol (FTP) is a system for transferring files over the Internet. An FTP server stores files, and FTP clients can log into FTP servers either to upload (transfer) files to the FTP server or (more commonly) to download files from the FTP server. To use FTP, you must have an FTP client program.

Most web browsers, including Internet Explorer and Mozilla Firefox, include an FTP client program that you can use to download and upload files. Web editors, including Microsoft FrontPage, include an FTP program for uploading your finished web pages to a web server.

Versions of Windows prior to Windows XP had an FTP client (described next ), but Windows XP and Windows Vista have an FTP client built into Windows Explorer.

Transferring Files Using FTP

To transfer files to or from an FTP server, you use Vista's separate FTP client program. Windows Vista comes with a basic command-driven FTP client program called Ftp. If you plan to do much file transfer, especially uploading, you'll want to use a better FTP client program, such as WS_FTP (see "Downloading, Installing, and Running Other Internet Programs" later in the chapter), or use the Internet Explorer feature called Open FTP Site In Windows Explorer.

Basics of FTP

To run the Windows Vista FTP program, choose Start All Programs Accessories Run Type ftp serverhost , where serverhost is the hostname of the FTP server, and click OK. If you are not connected to the Internet and you see your dial-up connection window, click Connect. You see the Ftp window, shown in Figure 28-4.

image from book
Figure 28-4: The Ftp window.

To connect to an FTP server, you specify the hostname of the server (for example, rtfm. mit.edu) and then log in. You have two choices:

  • If you have an account on the FTP server, log in with your username and password. You can access all the files that your username gives you permission to use.

  • If you don't have an account on the FTP server, the server may accept connections from guests. Connection without an account on the FTP server is called anonymous FTP. To use anonymous FTP, type anonymous for the username and your own e-mail address as the password. Thousands of FTP servers on the Internet allow you to use anonymous FTP to download files, although some are so busy that it may be hard to get connected.

Note  

UNIX, the operating system of choice among Internet servers, is sensitive to the case of the names of files, unlike Windows. Be aware of capitalization in filenames.

Once you are connected to an FTP server, it displays lots of messages to let you know what's going on. These messages start with three-digit numbers , which you can ignore. For example, when you have transferred a file, you see the message "226 Transfer Complete."

When you transfer a file-by either uploading or downloading-you must choose between two modes:

  • ASCII mode When transferring text files, use ASCII mode. Different computer systems use different characters to indicate the ends of lines. In ASCII mode, the Ftp program automatically adjusts line endings for the system to which the file is transferred.

  • Binary or Image mode When transferring files that consist of anything but unformatted text, use Binary mode. In Binary mode, the Ftp program does not make any changes to the contents of the file during transfer. Use Binary mode when transferring graphics files, audio files, video files, programs, or any kind of file other than plain text.

Tip  

At the ftp prompt, type? to see a listing of the commands that Ftp can perform.

Navigating the Folder Trees

The following are the most common FTP tasks :

  • To see a list of files and subdirectories in the current directory on the FTP server, type dir. The exact format of the listing depends on the FTP server's operating system. Figure 28-5 shows a typical listing. You can use wildcards (*) to limit the list. If you want to see filenames only, with no other information, you can use the Is (list) command.

    image from book
    Figure 28-5: A directory list from an FTP server.

  • To change directories, type cd (for "change directory"), followed by the name of the directory to which you want to move.

  • To find out the name of the current directory, type pwd (for "print working directory").

On many publicly accessible FTP servers, all the downloadable files are in a directory called pub. Here are a few tips for moving to the directory you want:

  • To move to the parent directory of the current directory, type cd .. (that is, the cd command followed by a space and two dots).

  • To move to the top-level directory on the FTP server, also called the root directory, type cd / (that is, the cd command followed by a space and a forward slash). Most FTP servers run the UNIX operating system, which uses forward slashes (as opposed to the backslashes used in Windows).

  • You can move directly to a directory by typing its full pathname, starting at the root; the full pathname starts with a / to represent the root directory.

  • If the FTP server runs the UNIX operating system, capitalization is important. When typing directory names or filenames, be sure to use the correct capitalization-most names use lowercase.

  • To change the current local directory (the folder from which Ftp can upload files and to which it can download files), type lcd (local directory), followed by the name of the folder on your computer. If the pathname of the folder contains spaces, enclose the pathname in quotes. To move to the parent folder of the current folder, type lcd .. (the lcd command followed by a space and two dots).

  • When you have finished transferring files, type quit or bye to disconnect from the FTP server. A message confirms that you have left the FTP server.

Tip  

If you want to disconnect from the FTP server and connect to a different server, you don't have to exit the Ftp program. Instead, type close or disconnect and press ENTER to disconnect from the FTP server. Next, type open , followed by a space, and then the hostname of another FTP server; and press ENTER to connect to the other server.

Uploading Files

You use the put command to upload the files. To upload a group of files, you can use the mput (multiple put) command.

Note  

You can upload files only if you have write permission in the directory on the FTP server. Most anonymous FTP servers don't accept uploads, or they accept them into only one specific directory. Read the welcome message to find out the rules for the FTP server you are using.

To upload a file, follow these steps:

  1. Connect to the FTP server, move to the directory on the FTP server in which you want to store the file, and set the current local directory to the folder on your computer that contains the files you want to upload.

  2. If the file or files you want to upload contain anything but unformatted ASCII text, type binary to select Binary mode (see "Basics of FTP" earlier in the chapter). To switch back to ASCII mode to transfer text files, type ascii.

  3. Type put, a space, the filename on your computer, a space, and the filename to use on the FTP server. Then press ENTER. For example, to upload a file named draftl3.doc and call the uploaded version report.doc, you would type put draftl3.doc report.doc.

  4. You see a series of messages; the message Transfer Complete appears when the file transfer is done.

    Caution  

    If a file with the name that you specify already exists on the FTP server, the put command may overwrite the existing file with the uploaded file. You can use the dir or Is command to check for the existence of a file with the same name.

  5. If you want to check that the file is really on the FTP server, type dir to see a listing of files in the current directory.

You can copy a group of files to the FTP server by typing mput , followed by a wildcard pattern that matches the names of the files you want to upload. The pattern * indicates that all files in the current directory on your computer should be copied . For example, to upload all the files with the extension .html, you would type mput *.html .

As it copies the files, mput asks you about each file. Type y to upload the file or n to skip it.

Tip  

If you don't want mput to ask you about each file before uploading it, type the prompt command first before giving the mput command. The prompt command turns off filename prompting.

Downloading Files

To download files from the FTP server to your computer, follow these steps:

  1. Connect to the FTP server, move to the directory on the FTP server that contains the file that you want to download, and set the current local directory to the folder on your computer in which you want to store the files you download.

  2. If the file or files you want to download contain anything but unformatted ASCII text, type binary to select Binary mode (see "Basics of FTP" earlier in the chapter). To switch back to ASCII mode to transfer text files, type ascii .

  3. Type get , a space, the filename on the FTP server, a space, and the filename to use on your computer. Then press ENTER. (You can't use filenames with spaces.) For example, to download a file named bud9812.doc and call the downloaded version budget.decl998.doc, the command is get bud9812.doc budget.dec2001.doc .

  4. You see a series of messages; the message Transfer Complete appears when the file transfer is done. To interrupt the file transfer, press CiRL-C. Sometimes that doesn't work, and the only way to interrupt the transfer is to close the FTP window.

  5. If you want to check whether the file is really downloaded, use Windows Explorer to see a listing of files on your computer.

You can copy a group of files to the FTP server by typing mget , followed by a wildcard pattern that matches the names of the files that you want to download. The pattern * means that all files in the current directory on your computer should be copied. For example, to download all the files whose names start with d , you would type mget d* .

As it copies the files, mget asks you about each file. Type y to download the file or n to skip it.

Tip  

If you download a nontext file that is unusable, you probably forgot to issue the binary command before downloading the file.

Using Windows Explorer to View an FTP Site

Another way to access FTP sites for uploading and downloading is to use Windows Explorer and Internet Explorer. Start Internet Explorer and connect to your FTP site. In the Address bar, use ftp:// instead of http:// for the preface of the site. This instructs IE that the site you want to visit is an FTP site. Once you access the site, you are presented with a logon screen. Enter a username and password and click OK. A screen like the one shown in Figure 28-6 appears.

image from book
Figure 28-6: An FTP site shown in Internet Explorer.

Once in, you can navigate the FTP site using IE. However, to make uploading and downloading files easier, use Windows Explorer. To do this, choose the Page menu from IE and click Open FTP Site In Windows Explorer. Windows Explorer starts and shows the directory structure of the FTP site in its window just as if it were from your local hard drive, similar to the one shown in Figure 28-7. You can now drag-and-drop files from the FTP site to your computer to download them, or drag-and-drop files from your computer to the FTP site to upload them. On slow FTP connections, the file transfers may take awhile. Also, sometimes your uploads and downloads may quit in the middle due to transmission problems or other reasons (the FTP server was shut down, for instance). In these cases, reconnect to the FTP site and try again.

image from book
Figure 28-7: An FTP site shown in Windows Explorer.



Windows Vista. The Complete Reference
Windows Vista: The Complete Reference (Complete Reference Series)
ISBN: 0072263768
EAN: 2147483647
Year: 2004
Pages: 296

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net