Remote-Control.Net

FTP Notes

FTP Notes




This article is for intermediate computer users who are new to the FTP protocol and need to copy files to or from a server on the internet.

FTP (File-Transfer-Protocol) is a way for you to copy files from one computer to another over a network such as the internet. This is usually done for copying files from your PC to a server for publishing websites. Some people use this as a method for distributing software from a server.

There is a "hard" way and the easy way to FTP files.

FTP the "Hard" Way
FTP may be done from a command prompt. It is good to learn to do it this way first because you may find yourself in a situation where you can't install a nice graphical FTP client program but still need to FTP something. It is also beneficial to learn the "hard" way first because it will help make some parts of a graphical FTP program understandable.

The way to connect your PC to an FTP server is to go to a command prompt and take a known FTP address and type:
ftp someservername
example:
ftp wuarchive.wustl.edu
After typing that in at a command prompt, you will be asked for a username and password. For the example above, you can use the username: anonymous and just hit the enter-key for the password. Many FTP sites will have a public area where you may use the special username anonymous to get in; these can be fun to explore. If you are publishing your website, you will receive a username and password to use from your service provider.

Once you are logged in, there are two directory locations you should be aware of. There is the working directory of your system and the working directory of the server you connected to. It is important to be aware of these two directories because this is where files are either coming from or being copied to.

You can take a look around on the server by typing DIR to list files and folders in the current working-directory on the server. FTP commands may be typed in upper or lower-case.

Your working directory on your PC is initially set to whatever directory you ran the FTP command from at the command prompt. So, for best results, after bringing up a command prompt, immediately change your directory to a comfortable local working directory then do your FTP command. You may also use the LCD command in the client program to change your current working directory or drive.

You may change the working directory you are using on the server by using the CD command. If you are connected to an anonymous FTP server, the first directory to go to is the pub directory; beyond that, you may find more directories and files. After using the CD command, type in the DIR command to take a look around to see what changed.
example:
cd pub
dir

After setting your working-directories on your PC and on the server, there are the GET and PUT commands to copy files. Type GET followed by a space and the filename to copy from the server or type PUT followed by a space and the filename to copy a file to the server. type:
get somefilename
to copy a file from the server or:
put somefilename
to copy a file to the server. If you logged in anonymously, you will not be able to copy to the server.

Read This! :)
My main reason for writing this article is to help you understand the difference between ASCII and BINARY file transfers. Before you do your GET or PUT commands, be sure to either type in ASC for ASCII or BIN for BINARY. ASC is for transfering plain text files that you can open up comfortably in programs like Notepad. Examples of ASCII files are: html files and txt files. BIN is for copying everything else like MSWord documents, pictures, software, etc. Type ASC or BIN once and all subsequent file transfers will use that transfer mode. Be sure to change it when appropriate.

More Detail (feel free to skip this paragraph - just be sure to use BIN and ASC correctly before using GET or PUT): BINARY transfer mode sends an exact copy of the file. ASCII transfer mode will cause the FTP software to inject the correct end-of-line characters as approprate for the server system and your PC. (Some operating systems use 1 byte end-of-line indicators and other operating systems use 2 byte end-of-line indicators. There are other issues that the ASCII transfer mode helps out with when you are transferring text files. Using the ASCII transfer mode will get your text files written correctly.

To get more help in the FTP program, type: HELP

To get out of the command-line FTP program type: QUIT

Other interesting commands are: MGET (copy many files from the server), MPUT, PROMPT (works with mget/mput -- turns off interactive prompting), HASH (show a file-transfer progress meter).

FTP the easy way
If you are using MS Windows, do a Google search for "FileZilla". This free program uses the same concepts as above, but lets you drag and drop files around. It will allow you to easily copy entire directories by drag-and-drop and will even automatically copy complex directory trees.

While its good to understand the difference between BINARY and ASCII file transfers as discussed above, FileZilla is set by default to automatically pick the correct transfer mode.