Guide to FTP Macintosh Version What is FTP? FTP (File Transfer Protocol) is a method for transferring files between 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 tehn 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 the procedure 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 SU-MacIP, which was developed at Stanford University. The procedure for launching SU-MacIP is as follows: -On the Mac desktop open the icon named LOCAL. -Open the folder named APPLICATION LAUNCHERS. -Open the folder named COMMUNICATIONS. -Now double-click on the icon for SU-MacIP to launch that application. Now that you have launched SU-MacIP you will want to open the NETWORK menu and select FTP. You will be presented with a dialog box asking you to supply a HOST NAME and a USER NAME. For example the host name might be: FTP.OTC.PSU.EDU or 128.118.46.3 You may type either of these addresses - they are the same thing. For user name you want to enter the word ANONYMOUS. Press the RETURN key after entering this information. The program will then connect with the remote host. 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 <-ENTERkey to submit the password). (NOTE: If you do this from your home computer system you would follow the @ with the domain name of the computer you are using, as in Fread@psuvm.psu.edu). An example follows. The characters <- are used to indicated where you press the RETURN key. login:anonymous <- password:Smith@ <- If all has been done correctly, you should now have an FTP connection established with the remote host computer. IMPORTANT NOTE: The SU-MacIP program has a Mac-like interface as well as a standard command-line interface. In this tutorial we will only be usinf=g the command line interface, which is the window appearing at the bottom of the SU-MacIP window. Navigating the Directory Structure Most computers supporting FTP have their file directories arranged in what is called a hierarchial file structure. This means that files ar grouped in directories and subdirectories. (This is like folders on the Mac.) 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 RETURN 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:58 etc drwxr-xr-x 5 root wheel 1024 May 5 10:58 users -r--r--r-- 5 root wheel 512 Sep 21 9:19 .profil since you are on a Macintosh you can use the scroll bar to examine this directory more fully. The directory listing gives you 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 to CD directly to the root directory. You may do this by means of the following command: CD / <- Please note that the 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 Drive or Subdirectory You may now need to change, on your local computer, the local disketter drive or subdirectory. When FTP is used at the Penn State microcomputer labs this is necessary to receive files to a floppy disk. As an InterNexus participant, you should have been provided with a blank floppy disk for this purpose. Please make sure you have inserted the floppy disk in the floppy diskette drive. With SU-MacIP you change the local diskette drive by clicking on the DRIVE button at the upper left of the SU- MacIP window. Each time you click on this button the volume name (under the button) will change to one of the disk volumes on your desktop. Continue until you see the volume name of your floppy disk. This has not set the floppy disk as the destination for any files you download. 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, meaning other than pure text. The distiction is important, because without specifying the file type there is a chance that the file transfer will 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 <- Note: Often Macintosh binary files are encoded into hexidecimal with the BINHEX program when stored on Internet file archives. When this is the case the file will have the characters .hqx appended to the file name. Binhex'd files are TEXT files, and therefore should be transferred using the ASCII mode. 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 copyinf 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 supoort different commands, although the commands provided in this document should be available on all hosts.