- Goals for This Hour
- What a Hierarchical File System Is All About
- Directory Separator Characters
- The Difference Between Relative and Absolute Filenames
- Summary
- Workshop
Directory Separator Characters
If you look at the organizational chart presented earlier in this hour (refer to Figure 3.1), you see that employees are identified simply as "employee" where possible. Because each has a unique path upward to the president, each has a unique identifier if all components of the path upward are specified.
For example, the rightmost of the four employees could be described as "Employee managed by Jr. Manager 4, managed by Senior Manager 3, managed by Vice-President 2, managed by the President." Using a single character, instead of "managed by," can considerably shorten the description: Employee/Jr. Manager 4/Senior Manager 3/Vice-President 2/President. Now consider the same path specified from the very top of the organization downward: President/Vice-President 2/Senior Manager 3/Jr. Manager 4/Employee.
Because only one person is at the top, that person can be safely dropped from the path without losing the uniqueness of the descriptor: /Vice-President 2/Senior Manager 3/Jr. Manager 4/Employee.
In this example, the / (pronounce it "slash") is serving as a directory separator character, a convenient shorthand to indicate different directories in a path.
The idea of using a single character isn’t unique to Unix, but using the slash is unusual. On the Macintosh, the system uses a colon to separate directories in a pathname. (Next time you’re on a Mac, try saving a file called test:file and see what happens.) DOS uses a backslash: \DOS indicates the DOS directory at the top level. The characters /tmp indicate the tmp directory at the top level of the Unix file system, and :Apps is a folder called Apps at the top of the Macintosh file system.
On the Macintosh, you rarely encounter the directory delineator because almost all users live in the graphical interface and don’t even know that there’s a Unix system—and command line interface—lurking beneath the Aqua environment. Windows also offers a similar level of freedom from having to worry about much of this complexity, although you’ll still need to remember whether "A:" is your floppy disk or hard disk drive.