INDEX CARD #17:
A directory can contain other directories (called subdirectories), and files.
What is a PATHNAME? Are there different types of pathnames? A pathname is the notation used to point to a particular file or directory. There are two types of pathnames: absolute and relative.
Here's an example to help explain the difference. Someone calls you on the telephone, and asks for directions to Carol's house (who lives next door). You give a long list of directions (absolute pathname). Now, someone knocks on your front door and asks you how to get to Carol's house (she's popular today). All you need to say is: "She lives right next door." (relative pathname)
Directions that are given FROM THE ROOT are called "absolute."
Directions that are given FROM WHERE YOU CURRENTLY ARE are called "relative."
ABSOLUTE vs. RELATIVE PATHNAMES (17b)
What is an ABSOLUTE PATHNAME? An absolute pathname is a set of instructions that starts at the root. Absolute pathnames are easy to recognize: they always begin with the forward slash (/). For example, the absolute pathname
-- start at the root (this is indicated by the forward slash)
-- choose the folder labeled "SCHOOL"
-- choose the subfolder labeled "HTML"
-- choose the file labeled "web_course.htm"
What is a RELATIVE PATHNAME? A relative pathname gives directions from the current working directory. When building a web site, relative pathnames are usually used, because the files you need are usually close by.
If a pathname doesn't begin with a forward slash, then it's assumed to be a relative pathname.
To go UP a level from where you are, use two dots (periods) in the pathname: ".."
To get from CALCULUS to web_course.htm, you'd use this relative pathname:
Printable version of Index Card 17a
Printable version of Index Card 17b
WORKSHEET #17: Make sure you can do the following: