Chapter 26: Other Internet Programs that Come with Windows XP
Transferring Files Using Ftp Another way to transfer files to or from an FTP server is by using a separate FTP client program. Windows XP 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 Web Folders (as described in the section "Working with FTP and Web Servers Using Web Folders" earlier in this chapter) or a better FTP client program, such as WS_FTP.
Basics of FTP To run the Windows XP FTP program, choose Start | Run. Type ftp serverhost, where serverhost is the host name 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, as shown in Figure 26-7.
Figure 26-7: The Ftp window To connect to an FTP server, you specify the host name of the server (for example, rtfm.mit.edu), and then you log in. You have two choices:
- If you have an account on the FTP server, log in with your user name and password. You can access all the files that your user name 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 user name 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.
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 file names. 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.
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 26-8 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 ls (list) command.
Figure 26-8: 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 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 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.
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 host name 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 command.
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:
- 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.
- If the file or files you want to upload contain anything but unformatted ASCII text, type binary to select Binary mode. To switch back to ASCII mode to transfer text files, type ascii.
- 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 draft13.doc and call the uploaded version report.doc, you would type put draft13.doc report.doc.
- You see a series of messages; the message Transfer Complete appears when the file transfer is done.
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 ls command to check for the existence of a file with the same name.
- 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 (multiple put). Type 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.
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:
- 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.
- If the file or files you want to download contain anything but unformatted ASCII text, type binary to select Binary mode. To switch back to ASCII mode to transfer text files, type ascii.
- Type get, a space, the filename on the FTP server, a space, 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.dec1998.doc, the command is get bud9812.doc budget.dec2001.doc.
- You see a series of messages; the message Transfer Complete appears when the file transfer is done. To interrupt the file transfer, press CTRL-C. Sometimes that doesn't work, and the only way to interrupt the transfer is to close the FTP window.
- 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 files or n to skip it.
If you download a nontext file that is unusable, you probably forgot to issue the binary command before downloading the file.