FTP Using your Command Prompt
Using command line FTP to upload to a web site
Nowadays, many software tools are available FTP file transfer. However, you can also use the tools that are built in to Windows, that is your command prompt and FTP client.
We assume that you are competent with the basics of Windows. These instructions are just a brief overview of what you need to do. Before you start, ensure you know your FTP user name and FTP password (see your service provider).
To connect to your web site using command line FTP
Follow the steps given below to connect to you site through ftp.
1. Open the DOS Command Prompt (Start>Programs>Accessories>Command Prompt).
2. Type: ftp
Example: C:\>ftp www.somename.com
3. If you do not already have an open connection to the Internet, the Dial-Up Networking dialogue box appears. Click Dial to connect, and follow any instructions that appear.
4. After the system establishes an Internet connection, the User prompt appears. Type your user name and press
5. Do similarly for your password.
6. You should see something like:
C:\>ftp www.somename.co.uk
Connected to abc.def.net.
220 abc.def.net FTP server ready.
User (abc.def.net:(none)): trickshore
331 Password required for
Password:
230 User
ftp>
The ftp prompt on the bottom line shows that you can now upload, download and delete files on your web site.
To upload to your web site using FTP client
You can either navigate to the directory that contains the files you want to upload, or you can specify the directory path when you upload. It's probably easiest to navigate to the relevant directory (details below).
- Set the transfer type:
- For ASCII files (such as HTML pages and CSS) type: ascii
- For binary files (such as graphics, exe files) type: bin
- For ASCII files (such as HTML pages and CSS) type: ascii
- Optional. Show the data transfer. Type: hash
- Navigate to the local directory (that is, on your computer) that contains the files that you want to upload. Type: lcd
Note: if there are any spaces in the path name, you must enclose the path in double quote marks. - Upload or delete files using FTP commands. The most useful are:
- To upload a single file use
put. Example:ftp>put myfile.pdf - To upload multiple files use
mput. Example:ftp>mput *.htm - To quit FTP use
quit
- To upload a single file use
- Close the Command Prompt.
The table lists the DOS-based FTP commands that you can use in the Windows Command Prompt (other raw FTP commands are available).
| FTP command | Does this |
| ! | Escape to the shell |
| ? | Print local help information |
| append | Append to a file |
| ascii | Set ASCII transfer type. Use this for transfering text files, such as .htm. See www.superior-host.com/webhosting-guide/linux-files.html for an excellent discussion of when to use ascii mode and when to use binary mode. |
| bell | Beep when command completed |
| binary | Set binary transfer type. Use this for transfering binary files such as .exe and graphics images |
| bye | Terminate the FTP session and exit |
| cd | Change remote working directory ( use .. to go to parent) |
| close | Terminate FTP session |
| delete | Delete remote file |
| debug | Toggle debugging mode |
| dir | List the contents of the remote directory |
| disconnect | Terminate the FTP session |
| get | Receive file |
| glob | Toggle metacharacter expansion of local file names |
| hash | Toggle printing '#' for each buffer transferred |
| help | Prints list of commands |
| lcd | Change the local working directory |
| literal | Send an arbitrary FTP command |
| ls | List contents of remote directory |
| mdelete | Delete multiple files |
| mdir | List the contents of multiple remote directories |
| mget | Get multiple files |
| mkdir | Make a directory on the remote machine |
| mls | List contents of multiple remote directories |
| mput | Send multiple files |
| open | Connect to remote FTP |
| prompt | Force interactive prompting on multiple commands (this is a toggle) |
| put | Send one file |
| pwd | Print working directory on remote machine |
| quit | Terminate FTP session and exit |
| quote | Send an arbitrary FTP command. You can view a list of raw FTP commands on www.nsftools.com/tips/RawFTP.htm |
| recv | Receive file |
| remotehelp | Get help from remote server |
| rename | Rename a file |
| rmdir | Remove a directory on the remote machine |
| send | Send one file |
| status | Show current status |
| trace | Toggle packet tracing |
| type | Set file transfer type |
| user | Send new user information |
| verbose | Toggle verbose mode |
Contributed by HillSinky Networks
On behalf of AneeS T