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 Microsoft Windows.We assume that you know how to use Microsoft 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
- Possibly, file names on an FTP site are case-sensitive. If you are not sure, ask your ISP. However, if you always make sure that the case is correct, errors cannot occur.
- These instructions are for the Windows operating system.
- Words
in this textare what you see in the Command Prompt. - Words in this text are what you type.
- <Enter> means press the Enter key (also known as the Return key).
- Replace text that is
<in angle brackets>with your particular text. - These instructions were confirmed using Windows 2000 and Windows XP. Possibly, they are correct for other versions of Windows, but possibly, there are small differences.
- Some FTP sites require that you connect using 'passive' mode. Passive mode is not supported in the Windows command line program (www.iss.net/security_center/advice/Services/FTP/PASV/default.htm). Therefore, you cannot use the method that is explained on this page.
- You can use Windows Explorer to transfer files by FTP. That is a much easier method than using FTP at the Command Prompt. Type the FTP address in the Address Bar and enter your user name and password. Then copy files in the usual manner.
To connect to your website using command line FTP
- Open the DOS Command Prompt (Start>Programs>Accessories>Command Prompt).
- Type: ftp <your website address> <Enter>
Example:C:\>ftp www.example.com - 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.
- After the system establishes an Internet connection, the
Userprompt appears. Type your user name and press <Enter>. - Type your password and press <Enter>.
- 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>
Theftpprompt on the last line shows that you can now upload, download, and delete files on the website.
To upload to your website
You can either 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).- 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>
- Optional. Show the data transfer. Type: hash <Enter>
- 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. - Upload or delete files using FTP commands. The most useful are:
- To upload a single file use
put. Example:ftp>put myfile.pdf <Enter> - To upload multiple files use
mput. Example:ftp>mput *.htm <Enter> - To quit FTP use
quit
- To upload a single file use
- 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 command | Does this |
|---|---|
| ! | Escape to the shell |
| ? | Print local help information |
| append | Append to a file |
| ascii | Set ASCII transfer type. Use this to transfer text files, such as .htm files. 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 to transfer binary files such as .exe files and graphics (see also ascii). |
| 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 (see also mget) |
| 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 (see also get) |
| mkdir | Make a directory on the remote machine |
| mls | List contents of multiple remote directories |
| mput | Send multiple files (see also put) |
| open | Connect to remote FTP |
| prompt | Force interactive prompting on multiple commands (this is a toggle) |
| put | Send one file (see also mput) |
| 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 |
0 comments:
Speak up your mind
Tell us what you're thinking... !