Guide to FTP IBM/DOS Version What is FTP? FTP (file transfer protocol) is a method for transferring files betwwen computers attached to the Internet. Programs supporting FTP allow users to easily move files from one Internet-connected computer to another. This is done by first establishing an FTP connection between the two computers and then issuing the proper commands to effect the file transfer. In some cases you will need to have a user account on the remote computer to establish the FTP connection. Some sites allow anonymous FTP, which means that no account is needed. We explain that process below. Anonymous FTP Sometimes an institution wants to make computer files publicly available to anyone on the Internet - without requiring them to have a computer account. For this purpose they may set up an account on their computer permitting anonymous FTP access. Establishing an FTP connection to a site supporting anonymous FTP is easy. When you are prompted for a userid, you enter the word anonymous; then for a password, you enter either your local computer account userid or your name. Establishing the FTP connection First you need to establish an FTP connection with the remote Internet host computer. This means running the local software package that supports FTP and providing it with the Internet address or IP number of the host. The software package used at the Penn State microcomputer labs is PC/TCP, marketed by a company namd FTP, Inc. For the ease of our students the IBM-PC systems at the micro labs have a menu system to help launch programs. When you first f=sit down at the computer you should see a menu titled PSU MAIN MENU. This menu has a number of options which are selected by using the cursor keys to highlight them. Press the up-arrow and down-arrow keys a few times and watch as you move through the menu selections. A menu selection is chosen by highlighting it and pressing the <- Enter key. Select the menu option HOST CONNECTION MENU. You will now see a menu of different host connection options. Select the menu option FILE TRANSFER PROGRAM. You will now be asked to Enter Host Name or IP Address. This is where you specify the name or IP number of the desired remote host computer. For example you may enter one of the following: FTP.OTC.PSU.EDU or 128.118.46.3 You may type wither of these addresses - they are the same thing. The program will then connect with the remote host and it will ask you to login. You want to login with the userid ANONYMOUS (pressing the <- Enter key to submit the userid). When you are asked for a password, you should specify your last name followed by an @ symbol, as in Smith@, Jones@, or Syzamansky@ (again, pressing the <- Enter key to submit the password). An example follows. The characters <- are used to indicate where you press the <- Enter key. login: anonymous <- password: Smith <- If all has been done correctly, you should now have an FTP connection established with the remote host computer. Navigating the Directory Structure Most computers supporting FTP have their file directories arranged in what is called a hierarchial file straucture. This means that files are grouped in directories and subdirectories. Typically, when you first establish an anonymous FTP connection, you will be set to the root directory of the remote host. This is the topmost directory. It may contain files, subdirectories, or both. Issuing the DIR command at this point will retrieve for you a directory listing of the files and subdirectories on the current (root) directory. To see what is in this directory, type DIR and press the <- Enter key. DIR <- You will then be presented with a directory listing that looks something like the following: -r--r--r-- 5 root wheel 5123 Aug 10 8:03 README drwxr-xr-x 5 root wheel 1024 May 5 10:58 bin drwxr-xr-x 5 root wheel 1024 May 5 10:58 pub drwxr-xr-x 5 root wheel 1024 May 5 10:50 etc drwxr-xr-x 5 root wheel 1024 May 5 10:58 users -r--r--r-- 5 root wheel 512 Sep 21 9:19 .profile This directory listing gives some important information. For example, the letter d in the first column of the listing indicates that this is a subdirectory under the current directory. So, you can deduce that bin, pub, etc, and users are all subdirectories. The remaining listings are for the files README and .profile. You may change the current directory to one of the subdirectories through use of the CD command. The format of this command is: CD <- A few examples based on the above directory listing follow. Please note that upper and lower case are very important distinctions on many host computers. Thus ETC and etc are not the same thing. CD bin <- CD .. <- CD pub <- this method works when the subdirectory you wish to change to is located under the current directory. You may find that you have to traverse a number of subdirectory levels to find the items you want. Moving up one level in the directory tree is quite easy. Issue the CD command followed by two periods, as in: CD .. <- Issuing this command will move you to the directory above the current directory, making that one the new current directory. A shortcut you may want to use is to CD directly to the root directory. You may do this by means of the following command: CD / <- Please note that that symbol for the root directory, when used with the CD command, is /. Using the CD command you can now navigate around the directory structure of any host you are connected to with FTP. Changing the Local Subdirectory You may now need to change,on your local computer, the local diskette drive or subdirectory. When FTP is used at the Penn State microcomputer labs it is necessary to receive files to a floppy disk. As an InterNexus perticipant you should have been provided with a blank floppy disk for this purpose. The command for changing the local drive or subdirectory is DRIVE. For example, to change to the root directory of a floppy disk in drive A: you would use the command: DRIVE A: <- Specifying File Type in Preparation for File Transfer Before actually transferring files, you will need to inform FTP of the file type. This type may be ASCII, meaning pure text, or BINARY, meaing other than pure text. The distinction is important, because without specifying the file type there is the chance that the file transferwill be done incorrectly and you will end up with a jumbled (and unusable) file. Once you specify a file type, that type will remain in effect until you either change it or close the FTP connection. The default (initially set) file type is ASCII. You set the file type by issuing the command ASCII or the command BINARY as in the following examples: ASCII <- or BINARY <- Getting a File from a Remote Host Once you have established the FTP connection with a remote host, changed subdirectory to that which contains the file or files you want, and changed the local drive and subdirectory to the one where you want the files to reside, you are now ready to copy the files from the remote computer. The command for doing this is GET. The form of the GET command is: GET <- where: is the name of the file on the remote host computer is the name you want the file to have when it is copied to your local computer Putting Files on a Remote Host The steps for copying files to a remote Internet host are essentially the same as those for copying files from a remote Internet host. The exception is that you must use the PUT command instead of the GET command. The syntax of the PUT command is as follows: PUT where: is the name you want the file to have when it is copied to your local computer is the name of the file on the remote host computer It is important to note that most sites do not allow anonymous PUTs. As a result we have not included PUT exercises in this tutorial. Built-in FTP Help When you are connected to a remote host via FTP there is some online help available. To get this online help you would enter one of the following commands: help <- or ? <- You will then be presented with a list of available FTP commands. Please note that different hosts will support different commands, although the commands provided in this document should be available on all hosts.