OS Module 2: Command Line Expedition: Growing file trees and visualizing tree structure

Building on existing trees created by your peers.

This sequence will guide you through building onto an existing file tree created by another CCAC student (both online and in-person). You'll get to decompress the existing tree, add your own content and structure, and graft an entire tree into the tree you're editing. You'll have a newfound appreciation of the power of tree-based file structures by the end.

Tutorial Video

For the video watchers out there--here's a step-by-step screen cast of your isntructor completing the core steps in this tutorial. It is particularly helpful if you are having trouble navigating the command prompt and tree-creation steps in this guide.

Learning Objectives


Unpack and analyze another student's file tree, build on that tree, and repackage the tree for sharing


Navigate a directory structure using the Windows Command prompt and the cd dir and tree programs



Exercise 1: Download and unpack an existing student file tree

Exercise type: Navigation of an operating System's tools

  1. Open Windows File Explorer. You should have a directory("folder") dedicated to our CIT-100 online class in an accessible place, like in MyDocuments. If you don't please create one now. In your CIT-100 folder, create a new directory called "expandedFileTrees" where you'll download some existing trees and tinker with them.
  2. I've transferred all of the file trees ya'll uploaded last week to my running set of file trees from several other CIT-100 and CIT-115 classes. Open the shared directory -- we might call this our digital forest--with this link.
  3. Take a stroll through this digital forest and look for a tree that is related to a topic that interests you. Choose a file tree and download it into your "expandedFileTrees" folder by right clicking the file and selecting "Download".
  4. NOTE: You should be prompted with a window to choose the location to save the file. Navigate to the "expandedFileTrees" directory you created in step 1 and save it in there. (NOTE: If you don't get a window to choose a location, your browser is probably set to save them in a default location which is likely the Downloads folder in your home directory in Windows. You'll need to user copy and paste commands to transfer the file from Downloads to "expandedFileTrees"). You should now be able to navigate into windows explorer and see the folder CIT100 and expandedFileTrees and a compressed folder inside this.
  5. tutorialImage
  6. After you download them, the tree is stored in a compressed file, which we need to decompress to restore it to its tree-like structure. In file explorer, navigate into "expandedFileTrees" and right click your downloaded tree and select "Extract All" or "Extract Here". Navigate any dialog boxes that come after selecting this option. If given the option, please extract the tree into the same folder: "expandedFileTrees". NOTE that the screen clip below has a program called WinZip instead of "Extract All"--be a good computer user and find the program that makes the most sense on your system.
  7. tutorialImage
  8. You should now see actual directories--not just files with a .zip extension--that you can navigate and explore. Check out the way your tree builder organized their content. Traverse into the tree's leaves and open some of the media. Think: What could I add to this tree?
  9. We are now going to visualize the tree you downloaded using a program called--of all things--"tree" which shows how a directory structure is organized. To do this, open a program called Command Prompt" by clicking your Windows icon in the lower left of your screen.
  10. tutorialImage
  11. You'll see a black window with something like "C:\" at the top (see above) and a flashing cursor. Welcome to the "back-end" of the Windows operating system. This program allows you to navigate to and run programs using your keyboard and typing specific commands which this tool turns into requests for the operating system to do something, like change the directory the program is viewing.
  12. NOTE: You'll do this by typing the command cd followed by a space and then the name of the directory you want to go into--but it has to be one of the subdirectories of your current directory. Note that the line that the cursor is on lists your current directory. So look at this screen clip:
  13. tutorialImage
  14. Note that I typed "cd Documents" to change my working directory into the Documents folder. This was possible because Documents is a folder inside C:\Users\ericd\. It is possible that your command prompt does not start in the same directory. You will need to use the combination of cd followed by the directory name you want to go into to get to the proper place. There are bunches of youtube videos--try searching "changing folders windows command prompt" to see some.
  15. Now that I am in the cit100 directory, I can use cd again to move into my expandedFileTrees directory like this:
  16. tutorialImage
  17. Notice that I can always type the command "dir" to see what directories and files are in my current working directory. If you don't see a directory with the name you want to move into in this list, you can't use a cd command to get in there.
  18. If you need to "up" into a parent folder, use cd .. (two periods). Note that your current folder is displayed as your command prompt.
  19. Once you are in the "expandedFileTrees" directory inside the command prompt, simply issue the command "tree" and boom! You'll see a printout on your screen of all the subfolders in that sub-folder which will display the structure of your peer's file tree. Isn't that neat!?!!?
  20. tutorialImage
  21. Now that we can see the file tree we downloaded, We want to compare the original file tree with content that you'll add to the tree, including new subfolders within the categories that your peer student created. Open a blank word processing document (this tutorial uses MS Word) and adjust the following formatting options:
  22. Change the margins on the page to 0.5"
  23. tutorialImage
  24. Turn on the rulers tool so we can see what we're going to do next:
  25. tutorialImage
  26. Format the page to have two columns:
  27. tutorialImage
  28. Add a header at the top of column 1 by selecting Header 1 from the Home tab like this:
  29. tutorialImage
  30. You can now copy and paste the file tree that the command prompt's "tree" program created into the left column of the word processing document. Select text in the black command prompt window by selecting the text you want to copy (the entire tree) and then clicking "enter". This is a strange command. When you click enter, you'll notice the selection goes away and now that text is in your "clipboard" which allows you to paste that into the word processing document using control + v.
  31. tutorialImage
  32. Make sure to format the pasted text nicely, so it fits on one column of one page. See the sample image below of a nicely formatted page. You'll want to do this by changing the line spacing to single:
  33. tutorialImage

    Add content to the existing tree: Grow the tree!!

  34. Now that you have a before shot, expand the tree you're working with by adding sub-folders and some new content like you built your own tree. The goal here is to see the expanded structure, so adding sub-folders is the most important thing, and adding images and links is secondary. Because the tree program only lists folders, any files you add won't add to the structure, just content. This is me adding a folder in Mellisha's board games tree:
  35. tutorialImage
  36. Once you have added 5-10 new folders and some content in them, re-run the tree program in command prompt to visualize your expanded tree. With the following steps:
  37. Follow the same steps above that we used above to copy and paste the before tree to copy and paste the expanded tree into the right column of the word processing document. Format both columns so they match each other. To do this, start by moving to the top of the right column by adding something called a column break--which tells the word processor to stop adding text in the current column and move to the top of the next one:
  38. tutorialImage
  39. Now go back to your command prompt and issue the command "tree" again. It should be in the proper directory since it doesn't change itself.
  40. Select the updated tree like before, and paste it into the word processor. Select the tree and format it as single-spaced lines. Now add a header 1 to the top of the expanded tree with a name like "Expanded Tree".
  41. Highlight the changes in the expanded tree that you added so that future students can see how the tree has grown!
  42. tutorialImage
  43. Your completed document should look something like this:
  44. tutorialImage
  45. Save the word processing document into your "expandedFileTrees" folder. You can use a logical name like "expandedTree.docx".
  46. Now we want to export this document as a PDF and upload it to the shared tree directory in the cloud so others can see the trees which are adjusted. If you are using MS Word, click "file" >> export >> pdf. But don't name the file yet, since we have to be careful:
  47. tutorialImage
  48. When you go to save this file, we want to name the file in a way such that when others view the file tree list in the cloud, they see your tree visualization right next to the original file tree zipped folder--this way it's convenient to see you nice work! To do this, name the PDF file exactly the same way as the original .zip folder, but add the text "_expandedBy[your name][your special id#]" to the end of the file name (see the example). Make sure to keep the .pdf extension so the file is viewable by PDF viewers worldwide. The following screen show shows me splitting my window so I can see both the online directory and my save window so the names can match. The important thing is that the first word or two are the same--copying the other student's magic number isn't important.
  49. tutorialImage
  50. Finally, re-compress your expanded tree by navigating to the "expandedFileTree" directory, selecting the root folder of the tree, and right clicking that file >> Send to >> Compressed Folder.
  51. tutorialImage
  52. You'll be given a chance to rename the zipped folder, which you should edit to be exactly the same name as the original zipped folder with the text "_expandedBy[yourname][your special ID]" added to the end. Once again, this is so future students can see the original tree, the expanded tree, and the diagram PDF you created all grouped together in the shared directory in the cloud.
  53. tutorialImage
  54. With your PDF and expanded tree all ready to roll, open our shared cloud folder (linked above) and upload both the expanded tree zipped folder, and your PDF. Remember, we want to upload "Files" not folders
  55. tutorialImage
  56. Check to make sure your file naming worked by scrolling to the top of the share directory and right-clicking the file name header and selecting sort "A-Z" and check to make sure your files are there and exist right alongside the original files. You may have to reload the page after your upload to see the files. If they don't please rename the files as needed and re-upload. You can't delete from the share drive, so drop your teacher an email and list the folders that need to be deleted due to improper naming.
  57. tutorialImage
  58. GREAT! That was a lot of work, but worth it. Students for years to come will get to build even on your expanded tree, and we'll have a truly growing digital forest. And now you have lots of confidence in navigating folder structures, using the command line, and the file compression utilities in the Windows operating system.

Tinker more with the Windows Command prompt

The command prompt that you used in the above learning sequence provides access to most basic file system operations that you've done so far in the graphical Windows Explorer program (clicking with the mouse instead of typing commands). The following steps will walk you through creating directories, files, and removing them using only the command line. Try it out! You'll feel like a whiz after, I promise!.

  1. Navigate to your expandedFileTress directory (or really, any other directory that you have write access to) and run the following commands that create a directory called testDir and then create a file called testfile.txt:
  2. tutorialImage
  3. Notice how the echo command works: we issue the command echo which is very simple: it takes whatever is passed into it (meaning any text that follows the command after the space) and sends it to the terminal screen. Try typing echo hereIAm. The > is a file redirect command which tells the command prompt program to take whatever the echo program outputs and send it to a file with the name testfile.txt.
  4. Let's verify that this command actually adjusted the file system by viewing the directory we just created and the file we created in the graphical Windows Explorer. You can right click the text file called testFile.txt and choose Open With >> notepad to see that we did indeed create a simple file with whatever text we sent into echo.
  5. tutorialImage
  6. Isn't that cool?! We can interact with the operating system using only our keyboard. For most of computer history, this is how commands were issued to the computer since they weren't powerful enough to cope with the graphical systems that we are so familiar with today.
  7. Now we can remove what we just created, cleaning up our workspace. Note that del command will delete anything you type, so be careful!
  8. tutorialImage
  9. We can verify that the delete worked by checking back in Windows Explorer and looking for the directory and file which was just there.

Page created on 15 Feb 2018 and last updated on 15 Feb 2018 and can be freely reproduced according to the site's content use agreement.