G53OPS - Operating Systems

This course is run at the The University of Nottingham within the School of Computer Science & IT. The course is run by Graham Kendall (EMAIL : gxk@cs.nott.ac.uk)


Path Names

When specifying a filename we can do so in one of two ways. We can specify its absolute path name. That is, we specify the entire filename. For example (these examples are given in MS-DOS, but the same logic applies to UNIX)

C:\COURSES\OPS\FILE SYSTEMS

This says the file, 'FILE SYSTEMS' is on the C: drive, and within the OPS directory which is a sub-directory of COURSES.
In fact, we could shorten this to

\COURSES\OPS\FILE SYSTEMS

The difference is that we are assuming that the default drive is the C: drive. The important point is that if a filename begins with a '\' (or a '/' under UNIX) then the pathname begins from the root directory and we are supplying an absolute path name.

Alternatively, we can specify a relative path name. The relative path name depends on what the current working directory (sometimes called just the current directory or the working directory) is. If the process that is running currently has a working directory of 'C:\COURSES' then the relative path name for the above file would be

OPS\FILE SYSTEMS

(Note the absence of the '\' at the start).

As a note of interest, in an interactive session, under UNIX you can find out the current working directory by typing 'PWD' (print working directory). Under MS-DOS it is usual to change the command prompt so that the current working directory is displayed on the command prompt. This is achieved by issuing a

PROMPT $p$g

(normally in a startup procedure such as AUTOEXEC.BAT).

The $p tells MS-DOS to display the current drive and working directory. The $g tells MS-DOS to display a '>' character, which is the usual MS-DOS prompt character.

As an exercise, every directory contains two entries. These are '.' and '..' (often called dot and dotdot). What do you think they represent and give some example of commands they use them?

Some suggested answers are given at the end of this section.

Last Page Back to Main Index Next Page

 

 


 Last Updated : 23/01/2002