UNCA CSCI 107 Lab 2 -- Files and directories

In today's lab you will be introduced to the files and directory structures on your personal computer and on bulldog. Today you will learn the following:

  1. How to use folders and files with Windows 95
  2. How to create text files with NotePad under Windows 95
  3. How to use folders and files with DOS
  4. How to use directories and files on bulldog
  5. How to create text files with pico on bulldog
  6. How to transfer files from your PC to bulldog

At the end of this assignment you will turn in a diskette to your instructor. Since the assignment is partially graded by a program which verifies that certain folders and files exist on your diskette, it is very important that create folders and files exactly where this lab specifies.

Section 1: Folders and files with Windows 95

  1. Select the My Computer icon on the desktop.
    Typical My Computer window
    From there, select your floppy diskette, A:. If your diskette has not been formatted, format it by selecting the Format action from the File menu.
  2. Use the Properties action of the File menu of the My Computer window to set the label of your diskette to be your last name.
  3. Double-click on the A: icon of the My Computer window to create a new window displaying the top-level files and folders of your diskette.
  4. Use the File to New to Folder menu selection path to create a new folder called CSCI107 on your diskette. At first the new folder will be called New Folder. You'll have to rename it CSCI107. You do this by patiently clicking on New Folder until Windows 95 indicates you can edit the folder name. If you've never done this before, solicit the aid of a neighbor. Double-click on the newly created folder to bring up a window labeledl CSCI107.
  5. Now we'll find some folders and files to copy to your diskette. Go back to the My Computer and this time click through the T:, for Teachers drive, though the csci folder, and into the Lab01 folder. This should give you a window labeled Lab01. You can now close all windows except for the ones labeled CSCI107, from the A: drive, and Lab01, from the T: drive.
  6. In the Lab01 window, use the Select All action of the Edit menu to highlight all folders and files. Copy these files into your diskette's CSCI107 folder by dragging the files from the Lab01 window into the CSCI107 window. If you've never dragged files before, ask your instructor or a fellow classmate for some help.
  7. You may now close the Lab01 window.
  8. Double-click on the Present.ppt icon. This starts Microsoft PowerPoint. Modify the PowerPoint document by pressing the mouse on the word "life" and changing it to the word "strife" (or something equally clever). Then save the modified file using the File and Save menu choices or simply by typing ^S (Control-S). Now exit PowerPoint.
  9. Remove the Wordp.doc file from your diskette by dragging it into the Recycle Bin.
  10. Move the Spreads.xls document into your Stuff folder with a drag. Notice that the file disappears from the CSCI107 window. Dragging a file between folders on the same drive, moves the file. Dragging between folders on different drives, copies the file.
  11. If you hold the control (Ctrl) key while dragging, the file is copied -- even within the same drive. Copy the Spreads.wb2 files into the Stuff folder. Double-click on the Stuff folder to make sure you were successful.
  12. Change the name of the file Wordp.wpd to CSCI107.wpd.
  13. Create a new folder called PlayPen within the CSCI107.
  14. Explore the various ways to examine files in Windows 95 by trying out the List and Details actions of the View menu.
  15. Make the Spreads.wb2 file of CSCI107 read-only by selecting Spreads.wb2 with the mouse and then by performing the Properties action of the File menu. You only need to click the Read-only check block.

Section 2: Creating text files with NotePad

  1. Double-click on the file Afile.txt of the Stuff folder. This will start up NotePad. Change this file and re-save it on your disk.
  2. Now go though the program menu (Start to Programs to Accessories to NotePad) to start NotePad. Write a paragraph about your favorite class last semester. Save this paragraph into a new file favclass.txt with your Stuff folder by using the Save As action of the File menu. If you are a first-time Windows 95 user, you may need some help for this.
  3. Exit NotePad.

Section 3: Creating directories and files with DOS

You'll notice an icon labeled MS-DOS Prompt on your desktop. This allows you to use the original command line interface to MS/DOS. Experienced users of Windows actually prefer the MS/DOS command line interface for many file operations.

For more information about the MS/DOS interface, look at David Hull's tutorial Frequently Used DOS Commands.

  1. Click on the MS-DOS Prompt icon to start an MS/DOS command processor.
  2. Type the line to make your diskette the default drive for your MS/DOS commands. You may close your other windows now.
  3. Type the command to connect to the root directory of your diskette. Now, A:\ is your default directory.
  4. Type the command to list the contents of the default directory. Notice that MS/DOS display more filenames in upper case letters than Windows 95 does.
  5. Now connect to the stuff subdirectory of CSCI107 and list its files and directories by typing
  6. In MS/DOS, you can use "wildcard characters" to list filenames that match a certain pattern. Type the command to list all files with an extension of txt. Now type to list all files whose names start with the letter 's'.
  7. MS/DOS has commands copy and move for copying and renaming files. Copy the file afile.txt to xfile.txt.
  8. Move the file bfile.txt to zfile.txt.
  9. The MS/DOS command del is used to delete files. Delete the file cfile.txt. Remember, you can use dir to check your progress.
  10. Use the command mkdir, or md if you prefer, to create subdirectories called msfun and msjoy.
  11. Use rmdir to delete the directory MoreStuff. You'll first have to delete all the files within the directory! The easy way to do this is
  12. MS/DOS borrowed a few nifty features from Unix. The command-line operator > redirects the output of a command to a file. Type the command to store a directory listing into the file file.lst. Use the command to display the contents of the file you just created.
  13. Type the command Annoying, isn't it. To keep this important information from flying across the screen, use the | operator, a variant of the Unix pipe, to display the file one screen at a time. Type to do this. The pipe operator can be useful in many other situations. Try out to list all the files in the root, or \, directory of the C: drive.
  14. Finally, one other convention MS/DOS adopted from Unix is the use of a single period . to refer to the current directory and of two periods .. to refer to the parent of the current directory. Use the command to list the contents of your parent directory.
  15. Terminate your MS/DOS command session.

Section 4: Directories and files on bulldog

Now we'll try some of the same commands on bulldog.

  1. First log into bulldog using the telnet program. Remember, you did this in the first lab.
  2. When you first log in you are connected to your home directory. Type the command: to discover the pathname for your home directory. You can generate a listing of your home directory with the ls command This command just lists the names of your files and directories. If you want a more informative listing, try the ls command with the -l option. (By the way, that's the letter l after the hyphen, not the number 1,) The output of this command will be lines looking somewhat like the following: In this particular case, information is being given about the directory public_html and the file ur-city.gif. The first letter of the line is (almost always) a d, for directory, or -, for file. The other information includes the file's access permissions, owner, size, and modification time. To learn more about Unix file permission, check out the CSCI 107 Unix File Permissions tutorial.
  3. Use the cd command to connect to your public_html subdirectory. This directory is where the files of your UNCA home page will be stored.
  4. Create a subdirectory of public_html called csci107. Use the mkdir command, just like in MS/DOS. Then use the ls command to see the files and subdirectories of your public_html directory.
  5. Use the cd command to move into your csci107 directory. Copy the file ~brock/107start.html into this directory. Just like in MS/DOS, the single period . means the current directory, and the double periods .. mean the parent directory. The copy command in Unix is cp.
  6. Use the Unix more command to look at your new file:
  7. Type the Unix command which invokes a shell script, written by Dean Brock, which modifies the permissions of your bulldog directory so that the files and sub-directories of your public_html directory can be accessed by the UNCA web server.

    This is a safe operation, but if you want to undo its effects, type the command

    at a later time.
  8. Now start up Netscape on your PC and load the URL http://www.unca.edu/~userid/csci107/107start.html where userid is your bulldog user id. This should display the page you just copied.

Useful Unix commands

Notice the strong similarity between Unix commands and MS/DOS commands. Unix got there first.

Command Action
cd Connect to a directory
ls List a directory
mkdir Make a directory
rmdir Remove a directory
cp Copy a file
mv Move a file
rm Remove a file
more Display a file
lpr Print a file

Useful Unix shell operators

Operator Action
* Matches several letters, including periods
ls /usr/bin/b*
? Matches one letter
ls /usr/bin/d?
| Pipes the output of one program to another
ls /usr/bin | more
> Directs the output of a program to a file
ls /usr/bin > dir.lst

Section 5: pico

The simplest Unix text editor is pico, which is distributed as part of the pinemail system.

  1. Use pico to edit the 107start.html file that you copied in Section 4 of the lab.

    At the least, replace the line that says:

    Be sure to use ^O to write out your changes. ^O is one of the many pico commands displayed at the bottom of your window. Be sure to type ^X to exit pico when you're done.
  2. Go back to Netscape and reload http://www.unca.edu/~userid/csci107/start107.html. You should see the changes you just made.

Section 6: Transfer files

In this section, we'll show you how to use FTP to transfer a files from your diskette to your bulldog account.

  1. Start up the FTP (File Transfer Protocol) program on your PC. You'll find FTP within the TELNETs and FTPs program group. It's called WS_FTP95.
  2. When FTP starts it will bring up the FTP connection dialog window shown below:
    Opening an FTP session
    Connect to bulldog.unca.edu with your bulldog userid and password.
  3. You should now see a data transfer window displaying both PC and bulldog files.
    An FTP connection
  4. The left side of the window is for your local files, those on the PC. Click on the [-a-] to connect FTP to your diskette. Then click on CSCI107 and then on Stuff to connect to your CSCI107/Stuff directory.
  5. The right side of the window is for your bulldog files. Click on public_html and then on csci107 to connect to your bulldog directory public_html/csci107.
  6. Now transfer the file favclass.txt that you earlier created with NotePad by clicking on favclass.txt and then on the right-pointing arrow, -->, between the two sides of the windows. Your file should now appear in the right window.
  7. Go back to Netscape. You should now be able to view your file with the URL http://www.unca.edu/~userid/csci107/favclass.txt. (or maybe http://www.unca.edu/~userid/csci107/Favclass.txt).

Return to CSCI 107 labs page
Return to CSCI 107.001 lecture page
Return to CSCI 107.002 lecture page
CSCI logoReturn to the UNCA Computer Science home page