How to use command line FTP to upload to a website

Many software tools are available for FTP file transfer. However, you can also use the tools that are in Windows.

To use these instructions, you must know how to use Windows. These instructions are an overview of what you need to do. Before you start, make sure that you know the FTP user name and the FTP password.

Notes

To connect to your website using command line FTP

  1. Open the DOS Command Prompt (Start>Programs>Accessories>Command Prompt).
  2. Type: ftp <your website address> <Enter>
    Example: C:\>ftp www.example.com
  3. If a connection to the Internet is not open, the Dial-Up Networking dialog box appears. Click Dial to connect, and obey any instructions that appear.
  4. After the system establishes an Internet connection, the User prompt appears. Type your user name and press <Enter>.
  5. Type your password and press <Enter>.
  6. Text appears. Here is an example:
    C:\>ftp www.example.com
    Connected to abc.def.net.
    220 abc.def.net FTP server ready.
    User (abc.def.net:(none)): joebloggs
    331 Password required for joebloggs.
    Password:
    230 User joebloggs logged in.
    ftp>


    The ftp prompt on the last line shows that you can now upload, download, and delete files on the website.

To upload to your website

You can navigate to the directory that contains the files that you want to upload, or you can specify the directory when you upload files. It is probably easiest to navigate to the applicable directory (this is the method that we show).

  1. Set the transfer type:
    • For ASCII files (such as HTML pages and CSS) type: ascii <Enter>
    • For binary files (such as graphics, exe files) type: bin <Enter>
  2. Optional. Show the data transfer. Type: hash <Enter>
  3. Navigate to the local directory (that is, on your computer) that contains the files that you want to upload. Type: lcd <directory> <Enter>
    Note: if there are spaces in the path name, put the path name in double quote marks.
  4. Upload or delete files using FTP commands. The most useful are:
    • To upload one file use put. Example: ftp> put myfile.pdf <Enter>
    • To upload many files use mput. Example: ftp> mput *.htm <Enter>
    • To quit FTP use quit
  5. Close the Command Prompt.

List of FTP commands

The table lists the DOS-based FTP commands that you can use in the Windows Command Prompt (other FTP commands are available). Some of the explanations are quite cryptic. Sorry.

FTP commands available in DOS
FTP commandDoes this
!Escape to the shell
?Print local help information
appendAppend to a file
asciiSet ASCII transfer type. Use this to transfer text files, such as .htm files (refer also to binary).
bellBeep when command completed
binarySet binary transfer type. Use this to transfer binary files such as .exe files and graphics (refer also to ascii).
byeTerminate the FTP session and exit
cdChange remote working directory ( use .. to go to parent)
closeTerminate FTP session
deleteDelete remote file
debugToggle debugging mode
dirList the contents of the remote directory
disconnectTerminate the FTP session
getReceive file (refer also to mget)
globToggle metacharacter expansion of local file names
hashToggle printing '#' for each buffer transferred
helpPrints list of commands
lcdChange the local working directory
literalSend an arbitrary FTP command
lsList contents of remote directory
mdeleteDelete multiple files
mdirList the contents of multiple remote directories
mgetGet multiple files (refer also to get)
mkdirMake a directory on the remote machine
mlsList contents of multiple remote directories
mputSend multiple files (refer also to put)
openConnect to remote FTP
promptForce interactive prompting on multiple commands (this is a toggle)
putSend one file (refer also to mput)
pwdPrint working directory on remote machine
quitTerminate FTP session and exit
quoteSend an arbitrary FTP command. You can view a list of raw FTP commands on www.nsftools.com/tips/RawFTP.htm
recvReceive file
remotehelpGet help from remote server
renameRename a file
rmdirRemove a directory on the remote machine
sendSend one file
statusShow current status
traceToggle packet tracing
typeSet file transfer type
userSend new user information
verboseToggle verbose mode
RSS feed