One of the most common and useful Internet tools for small office/home office (SOHO) and home users is the FTP client. FTP is a standard Internet protocol that lets you easily transfer large files (e.g., images, music) to and from remote computer systems.Ipswitch's WS_FTP and GlobalSCAPE's CuteFTP are well-known and commonly used GUI-based FTP tools. Check out the evaluation versions of these FTP tools, but before you decide to buy, learn how to use the command-line FTP tool that Microsoft built in to all current versions of Windows. With little effort, you can use the Windows FTP client to manage all your FTP needs. You might find third-party tools' user-friendly interfaces easier to use than the Windows FTP client, but the Windows command-line tool is perfect for occasional FTP users who have the time and interest in learning how to use it.
Windows XP's FTP service installs as part of Microsoft Internet Information Services (IIS) 5.1; the FTP host is available only in XP Professional Edition, and the command-line client is available in both XP Pro and XP Home Edition. To reach the FTP client, click Start, then click Run. Type
in the resulting dialog box.
A useful command-line function available through the Windows FTP client lets you write scripts that execute FTP file transfers and automate FTP tasks. The command
returns the line
ftp \[-v\] \[-d\] \[-i\] \[-n\] \[-g\] \[-s:filename\] \[-a\] \[-w:windowsize\] \[-A\] \[host\]
where -v suppresses the display of remote server responses, -d enables debugging, -i turns off interactive prompting during multiple file transfers, -n suppresses auto logon upon initial connection, -g disables filename globbing (see information about the Glob command below), -s:filename specifies a text file containing FTP commands (the commands will automatically run after FTP starts), -a lets you use any local interface when binding data connection, -w:windowsize overrides the default transfer buffer size of 4096, -A enables anonymous logon, and host specifies the host name or IP address of the remote host to which you're connecting.
Those command parameters let you determine how you will connect to the FTP service on another computer. In most cases, you would use the FTP client interactively and could simply enter the following command:
For example, the following line would connect you to the FTP server ftp.chernicoff.com:
The host would prompt you for a username and password. Most publicly available FTP servers support anonymous FTP, which lets you enter anonymous as your username and anything (usually your email address) as your password. You need to enter something at the password prompt; a blank password won't work. After you enter the interactive FTP console, 42 FTP commands are available to help you manage and use your FTP session. By typing
at the FTP prompt, you'll get a list of the available commands. To get help with any command, use the syntax
For example, the command
will display help for the Dir command.
The following is a list of available FTP commands and how you can use them.
- !-The ! command causes the FTP console to shell to an XP command console. If you need to execute a different XP command-processor command in the same window as your FTP session without disconnecting the FTP session, use this command.
- ?-The ? command returns Help information for a selected FTP command.
- Append-The Append command works the same way as the command-prompt Append command: It lets you combine two files. In FTP, however, Append lets you combine a local file with a file on the FTP server. The syntax is
append local_file \[remote_file\]
- Ascii-The FTP service isn't very bright. It knows that it can transfer files, but it doesn't understand the difference between simple text files and binary files. By default, it assumes it's transferring simple text (i.e., ASCII) files; if you transfer a binary file (e.g., programs, proprietary document formats, DLLs) in that mode, the files arrive at their destination in an unusable format. Using the Ascii command tells the FTP program that you plan to transfer a text file. The command requires no parameters.
- Bell-The Bell command tells the FTP program to play a sound when a file transfer finishes. Each time you type
bellthe command changes the state from on to off or vice versa. The command requires no parameters, and the default state is off.
- Binary-The Binary command sets the file-transfer mode to binary and allows the successful transfer of file types other than simple text. Entering this command sets up the program for binary file transfers. Binary requires no parameters.
- Bye-The Bye command disconnects the FTP session and exits the FTP console. The command requires no parameters
- Cd-The Cd command changes the working directory on the remote computer. The syntax is the same as the Cd command at the local command prompt. The only parameter is the name of the directory you want to switch to (e.g., cd \dirname).
- Close-The Close command shuts down the current FTP connection but leaves you in the FTP console. The command requires no parameters.
- Debug-Toggling Debug mode on means that all the details about commands you send to an FTP host will display on the client console. This information is useful if your connection is having problems; you'll be able to see where in the sequence of events a connection is failing. Entering the Debug command toggles the information on or off. The default state is off, and the command requires no parameters.
- Delete-Delete lets you delete files on the remote computer (if the account that you used to log on to the FTP server has sufficient privileges). The syntax is
- Dir-Dir is the directory command for the remote computer and displays a list of files and subdirectories that reside on the remote computer. Two parameters are available; you can specify a subdirectory to enumerate, and you can specify a filename to write the directory information to on the local machine. The command
dir \subdir1 remote.txtenumerates the subdirectory subdir1 and writes the list of its contents to the file remote.txt on your local machine, in the directory from which you launched the FTP client.
- Disconnect-The Disconnect command provides the same function as the Close command. It disconnects the FTP session and returns the console to the FTP prompt.
- Get-The Get command copies a file from the remote computer to the local computer. It also lets you rename the file when the file is being copied. The command
get file_namesimply transfers the file to the local directory. The command
get file_name local_file_namelets you rename the local copy of the file. Remember to set the file-transfer mode to the appropriate mode by using the Ascii or Binary command before initiating the file transfer.
- Glob-The Glob command lets you use wildcards with other FTP file-management commands. Glob supports the use of the asterisk and question mark in filenames the same way they work in any command-line action. Glob is enabled by default. Entering the command will toggle the function off or on, depending on the current state. The command requires no parameters.
- Hash-The Hash command causes the console to print a pound sign (#) for every 2KB of data that transmits during uploading or downloading. By default, the hash function is off.
- Help-The Help command displays a list of available commands.
- Lcd-The Lcd command lets you change the FTP client's local working directory. Entering
lcdwith no parameter displays the current directory path. Entering
lcd directory_namechanges the local working directory to the specified directory.
- Literal-The Literal command lets you pass a specific command string to the FTP server. If the server supports additional features that the XP FTP console doesn't understand, you could use the syntax
literal command_stringto pass the command string to the server. The command has no other parameters.
- Ls-Ls is the UNIX Dir command and is identical to the Dir command I described earlier.
- Msdelete-The Mdelete command functions the same as the Delete command but includes the ability to send a list of filenames from the remote computer. The syntax is
mdelete file1, file2, file3
- Mdir-Like the Dir command, the Mdir command lets you request a list of files from the remote computer and also lets you send a list of locations (i.e., directories) to return the file listing from.
- Mget-The Mget command functions the same as the Get command but allows multiple file retrievals and doesn't let you rename the files during download.
- Mkdir-The Mkdir command lets you create a new directory on the remote machine if your account has sufficient privileges. The syntax is
- Mls-The Mls command lets you display a list of filenames and directory names from the remote computer without all the associated information that the Dir and Ls commands display. To use Mls, you need to include the command parameters that define which files you want to display and whether you want them displayed on the screen or written to a directory. Using a hyphen as the only parameter (e.g., mls - -) will display all the information to the console screen.
- Mput-The Mput command is the same as the Put command but lets you upload multiple files without intervention. It doesn't let you rename files on transfer.
- Open-The Open command connects you to another FTP server from the FTP prompt.
The syntax is
open target_computer port_numberThe port number is necessary only if the target computer is running the FTP server on a port other than the standard TCP port 21.
- Prompt-If you toggle the Prompt command on (default is off), the Mget and Mput commands will cause the console to prompt you for specific details between each file transfer, giving you the ability to rename or redirect each file that you're transferring.
- Put-The Put command copies a file from the local computer to the remote computer. It also lets you rename the file while the file is being copied. The command
put file_namesimply transfers the file to the local directory. The command
put file_name remote0l_file_namelets you rename the remote copy of the file. Remember to set the appropriate file-transfer mode by using the Ascii or Binary command before you initiate the file transfer.
- Pwd-The Pwd command prints the current directory on the remote computer.
- Quit-The Quit command closes the FTP session and exits the FTP console.
- Quote-The Quote command performs the same function as the Literal command.
- Recv-The Recv command is the same as the Get command.
- Remotehelp-The Remotehelp command displays the list of commands for which help is available on the FTP server. The
remotehelp commandsyntax specifies the command for which you need help.
- Rename-The Rename command lets you rename files on the remote computer. The syntax is
rename current_name new_name
- Rmdir-The Rmdir command removes a remote directory if the account that you're using has sufficient privileges. The syntax is
- Send-The Send command is the same as the Put command.
- Status-The Status command shows the current status of the FTP console and connection (e.g., Connected to FTP.chernicoff.com. Type: ascii; Verbose: On; Bell: Off; Prompting: On; Globbing: On; Debugging: Off; Hash mark printing: Off.)
- Trace-When you enable the Trace command, the FTP console will display the FTP functions that execute for each command that runs. This debugging tool can show you where problems are occurring in an FTP connection. The command has no parameters.
- Type-The Type command will show the user which transfer mode (i.e., ASCII, Binary) is currently selected. You can use the commands
type binaryto set the transfer mode.
XP and Windows 2000 contain many command-line networking tools in addition to the FTP client that can make the SOHO and home user's life easier. In coming weeks, I'll provide detailed instructions about how to use those tools.
- User-The User command lets a specific user log on to the remote computer. The syntax is
user username password account
If you don't provide the password and account, the FTP console will prompt you for them.
- Verbose-The Verbose command causes the FTP console to display all the responses it receives from the FTP server. The default state is on. The command has no parameters.