File Transfer Protocol ("FTP") Commands
Arranged by Brian Regan
2001 Nov 8, revised 2012 Apr 04

FTP:  Transfers files to and from a computer (Windows or UNIX) running an FTP server service (sometimes called a daemon).  Ftp can be used interactively.  All of the following are used at the command prompt.
Sample FTP Command Files 
Syntax:
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, e.g., MyFTPcmd.txt;  the commands will automatically run after FTP starts.  E.g.:
open harbornet.com (or for non-FTP sites: open www.harbornet.com)
myUserName
myPassword
dir
-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.



Commands may be abbreviated. Commands are:

! Escape to the shell.
? Print local help information.
append Append to a file.
ascii Switch to ascii mode.  Ascii mode is the default mode and used for transferring text files
bell Beep when command is completed.
binary Switch to binary mode.  For transferring binary files like .ZIP files, .Z files and the like.
bye Terminate the FTP session.  (Same as "quit.")
cd Change the directory on the remote computer.
cl(ose) Disconnect from host (but don't terminate FTP session).
debug Toggle debugging mode.
delete Delete remote file.
dir List the files in the current directory on the remote computer.
disconnect Disconnect from host (but don't terminate FTP session).
literal Send arbitrary FTP command.  (Same as "quote.")
ls Same as 'dir', but shows less information sometimes.
get Copy a file from the remote computer to yours.  (Same as "recv.")
glob Toggle metacharacter expansion of local filenames.
hash Puts a '#' on the screen for every x of bytes transferred. x is 1024 in some cases, 2048 in others but is between 1024 and 4096 in most cases. Check the ftp 'help' function for more info on the number for your clientprogram.
help Gives help on the use of commands within the ftp program.
lcd * Change the directory on your computer (the 'l' is for local)
lpwd * Shows the present working directory (pwd) on your computer (the 'l' is for local).  Note:  this may not work on all machines.  On a Unix machine, try !pwd if lwpd doesn't work.  In Windows, ! CD will work.
lwd Change local working directory.  (The 'l' is for 'local.')
mdelete Delete multiple files.
mdir List contents of multiple remote directories.
mget Copy multiple files from the remote computer to yours.
mkdir Make directory on remote machine.
mls List contents of multiple remote directories.
mput Send multiple files.
open Connect to remote tftp (host).
prompt Force interactive prompting on multiple commands.
put Send one file.  (Same as "send.")
pwd Shows the present working directory (pwd) on the remote computer
quit Terminate FTP session and quit.  (Same as "bye.")
quote Send arbitrary FTP command.  (Same as "literal.")
recv Receive file.  (Same as "get.")
remotehelp Get help from remote server.
rename Rename file.
rmdir Remove directory on the remote machine.
send Send one file.  (Same as "put.")
status Show current status.
trace Toggle packet tracing.
type Set file tranfer type.
user Send new user information.
verbose Toggle verbose mode.
* - These commands do not work for Windows 2000 FTP.
Most of the other commands are the same as, or similar to, DOS commands, although it is necessary to use the "full" form of some of them, e.g., "mkdir" instead of "md."

Sample FTP Command Files


For http://www.yelmtel.com/~theedrich/
FtpYelmTel.txt:

open ftp.yelmtel.com
theedrich
NDi9LjGA
cd public_html
dir

For http://www.ywave.com/~theedrich/
FtpYwave.txt:

open ftp.ywave.com
theedrich
NDi9LjGA
cd public_html
dir

For http://www.hieronymus.us/
(Jerome - iPowerWeb)
(Mail:† http://host350.ipowerweb.com:8080/webmail4/index.pl
Login:† hieronym@hieronymus.us)
FtpJerome.txt:

open ftp.hieronymus.us
hieronym
thunder
cd public_html
dir

For http://www.harbornet.com/folks/theedrich/
FtpHive.txt:

open www.harbornet.com
theedrich
thunder
cd hive
dir
Sample CMD prompt entries:
2012 Apr 04 [Wed]
ftp> open harbornet.com
Connected to harbornet.com
220 Welcome to Rainier Connectís User Web FTP server.
User (harbornet.com:(none)): theedrich
331 Please specify the password.
Password:    (password is entered)
230 Login successful
FTP> dir
200 PORT command successful. Consider using PASV.
150 Here comes the directory listing.
drwxr-xr-x 2 501 4096 Apr 04 19:04 Colores
drwxr-xr-x 4 501 4096 Apr 04 19:04 Dany
    .
    .
(et cetera)
226 Directory send OK.
ftp: 716 bytes received in 0.02Seconds 42.12Kbytes/sec.
ftp>
->>†>>†>><<†<<†<<-