Sie sind auf Seite 1von 4

FTP Commands (DOS's FTP.exe) Technical note: The FTP command, ftp.exe, is located in the windows "system32" directory.

(ex: c:\windows\system32\ftp.exe or c:\winnt\system32\ftp.exe). If you get a DOS error bad command, then put the full pathname for the executible. Getting a connection to the FTP server from the DOS prompt: 1. Get to a DOS Prompt. (ie: Start, Run, command.com) 2. c:> ftp [ftp server name or IP Address] 3. Enter your username & Password. 4. To disconnect type: disconnect or 1. From DOS, type: ftp 2. ftp> open <hostname or IP address> 3. Enter your username & Password 4. To disconnect type: disconnect After you have signed on here is some FTP commands:

help <enter> - gives a list off FTP commands. help [command name] - give brief help. ? [command name] - give brief help. open [server name] - opens a connection to a new web server. disconnect - terminates ftp session. bye - logoff & exit FTP. exit - Terminate FTP session and exit. lcd [directory name] - Change local working directory. cd - change remote working directory (at FTP site). get [filename] - download a file to your local working directory. get <enter> - will prompt for remote-file, then local-file.

mget *.* - Get multiple files. If prompt is on, will prompt Y/N for each file matching the wildcard. prompt <enter> - toggles prompting on or off. ON by default. put [filename] - upload a file to the web server. put <enter> - will prompt for remote-file, then local-file. mput *.* - Put multiple files. If prompt is on, will prompt Y/N for each file matching the wildcard. prompt <enter> - toggles prompting on or off. ON by default. pwd - shows your current working directory on the remote server. mkdir [directory name] - creates (make) a new directory on remote server. rmdir [directory name] - removes (delete) a directory on remote server - if empty. delete [filename] - deletes a remote file. user [username] - changes current user on current server quote <command> - sends a command to the ftp server. binary - switches to binary file transfer mode. hash - This is to show you the progress of the upload. ls or dir - List contents of remote directory. Warning: This may kick you off of the server (close the connection). I think this might happen if you don't have directory listing rights. Other FTP commands
o o o o o

! - Escape to shell. append - append to a file. ascii - set ascii transfer type. bell - beep when a command completes. close - terminate ftp session.

glob - Toggle metacharacter expansion of local file names. literal - send arbitrary ftp command. mdelete - delete multiple files mdir - list contents of multiple remote directories mget - get multiple files. mls - list contents of multiple remote directories mput - send multiple files prompt - force interactive prompting on multiple commands quote - send arbitrary FTP command recv - receive file remotehelp - get help from remote server (list of remote server commands) rename - rename a file. send - send one file. status - show current status trace - toggle packet tracing user - send new user information (??? verbose - toggles verbose mode (default: on)

o o o o o o o

o o o

o o o o o o

Example: FTP a file to the server


Log onto the FTP server (see above) cd <pathname> - use this to CD to a directory on the remote computer lcd <pathname> - use this to CD to a directory on your local computer. bin - Turns on binary transfer.

hash - Turns on progress. put <filename> - This will FTP the file. debug - toggle debugging mode.

Using .bat files and ftp Scripts.

You can use FTP Scripts to automate your DOS FTP processes. Here is an example of a batch file and FTP script file that will transfer a file to the root directory of an FTP server: o Create a text file with the following content called: DosFtpFile.txt Hello World
o

Create a batch file with the following content called: DosFtpFile.bat ftp -s:DosFtpFile.ftp <ftp_ server_ name> pause Create a script file with the following content cassed: DosFtpFile.ftp <place_your_user_name_here> <place_your_user_password_here> put DosFtpFile.txt quit

Das könnte Ihnen auch gefallen