Introduction to Operating Systems

Introduction to Operating Systems

Sections: 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | Index | Next >

Absolute and relative paths

Learning objective: Explain the use of absolute and relative paths

pic of absolute and relative paths
Click on image to enlarge.

To copy a file using both relative and absolute references, again imagine starting from ENG104 which would be the current or working directory, and providing the path from this location to the target destination. It is up to the user to know the full source and destination paths when executing this command. In this example, if we wanted to copy a file from ENG104 directory to the Backup directory, the command would be: COPY file \Backup. This assumes that we are currently in the ENG104 directory. The \ references the root. The full path is given to identify the downward direction to the destination. When paths are identified, the system will follow them down to that location.

COPY file [space] \Backup

Other examples:

To copy a file from the Personal directory (as the working directory) to the School directory:

COPY file.txt [space] \School

To copy a file from the School directory (as the working directory) to the CMPTR111 directory:

COPY ENG104\file.txt [space] \School\CMPTR111

To copy a file from the ENG104 directory (as the working directory) to the root "\":

COPY file.txt [space] \

Thinking: What are the benefits and problems with using a mix of relative and absolute paths?

Key terms: absolute path, directory, file, path, relative path, root

Sections: 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | Index | Next >