MS-DOS Commands :: ftp
Overview:
Warning: This command is for advanced users only!
FTP (file transfer program) to transfer files to/from server.
Tip: We recommend that you use a
Windows-based FTP program rather than using theMS-DOS ftp command. Personally, we useCuteFTP Pro .
Commands:
Type ftp to start the FTP program. The FTP command prompt will appear. You can then type the following commands.
Tip: When done, type bye (or quite) to exit the FTP program and return to the
MS-DOS prompt.
Command | Meaning |
! | Escape to the shell |
? | Prints list of available commands |
append | Append to a file |
ascii | Set ascii transfer type |
bell | Beep when command completed |
binary | Set binary transfer type |
bye | Terminate ftp session and exit |
cd | Change remote working directory |
close | Terminate ftp session |
delete | Delete remote file |
debug | Toggle debugging mode |
dir | List contents of remote directory |
disconnect | Terminate ftp session |
get | Receive file |
glob | Toggle metacharacter expansion of local file names |
hash | Toggle printing `#' for each buffer transferred |
help | Prints list of available commands |
lcd | Change local working directory |
literal | Send arbitrary ftp command |
ls | List contents of remote directory |
mdelete | Delete multiple files |
mdir | List contents of multiple remote directories |
mget | Get multiple files |
mkdir | Make directory on the remote machine |
mls | List contents of multiple remote directories |
mput | Send multiple files |
open | Connect to remote tftp |
prompt | Force interactive prompting on multiple commands |
put | Send one file |
pwd | Print working directory on remote machine |
quit | Terminate ftp session and exit |
quote | Send arbitrary ftp command |
recv | Receive file |
remotehelp | Get help from remote server |
rename | Rename file |
rmdir | Remove directory on the remote machine |
send | Send one file |
status | Show current status |
trace | Toggle packet tracing |
type | Set file transfer type |
user | Send user login information |
verbose | Toggle verbose mode |
Automation:
If you want to automate the downloading/uploading of a file or files, you can do that by creating a text file that contains the FTP commands to be performed. For example, to download a specific file, create a text file that has the following content:
open host username password cd directory binary get filename byeFor the parameters (shown above in yellow), type in the actual values. For example, if your FTP server is ftp.myserver.com then type that in place of host. Similarly, substitute in the values of the other parameters: username, password, directory (e.g.: /www), and filename.
Save the above "FTP script" and give it a filename such as getfile.txt (you can name it anything; the filename does not matter). To run ftp and make it use this FTP script, you would type
ftp -i -s:getfile.txt which tells the ftp command to run innon-interactive mode (i.e.: -i) and to read FTP commands from the specified file (i.e.: -s:filename).After you create the FTP script, you could also create a corresponding batch file that runs ftp with this FTP script. In the above example, the FTP script file was named getfile.txt, so create a text file named getfile.bat (this filename is just to be consistent; you can use any filename) with the following contents:
@echo off ftp -i -s:getfile.txtTo run this batch file you would simply type getfile (or getfile.bat). The batch file will run, which will cause ftp to be run, and ftp will read the FTP script getfile.txt, which will cause your file to be downloaded.
ftp -help
Transfers files to and from a computer running an FTP server service (sometimes called a daemon). Ftp can be used interactively. FTP [-v] [-d] [-i] [-n] [-g] [-s:filename] [-a] [-w:windowsize] [-A] [host] -v Suppresses display of remote server responses. -n Suppresses auto-login upon initial connection. -i Turns off interactive prompting during multiple file transfers. -d Enables debugging. -g Disables filename globbing (see GLOB command). -s:filename Specifies a text file containing FTP commands; the commands will automatically run after FTP starts. -a Use any local interface when binding data connection. -A login as anonymous. -w:buffersize Overrides the default transfer buffer size of 4096. host Specifies the host name or IP address of the remote host to connect to. Notes: - mget and mput commands take y/n/q for yes/no/quit. - Use Control-C to abort commands.
(Enlarge: ftp -help)