Pathname
A path name (also path ) is a character string that designates a file , a directory or, depending on the platform , other resources on a computer system , for example device files under Unix .
construction
Depending on the operating system , a path name consists of the following elements:
- a drive or volume label
- a list of directories or (sub) directories
- a filename
Almost all modern operating systems are designed to manage data (and thus files and directories) on multiple physical data carriers . Different approaches are used to address the data:
- Under Windows, for example, a path is preceded by an identification letter for the corresponding drive in which the data carrier is located.
- Example of a path name under Windows:
C:\privat\testdata\beispiel.txt
- Here designates
C
the drive on which the file is located. In the top level of the file tree on this hard drive there is a directoryprivat
, including one with a nametestdata
, and the filebeispiel.txt
can be found there.
- Under Unix and Unix derivatives (e.g. Linux , NetBSD ) there is a “ root directory ”, from which addressing is purely directory-oriented. The root directory is usually on the data carrier from which the system is started. The operating system supports the integration of other available media then managing mount points , English mount points .
- Example of a file name under Unix:
/home/benutzer/beispieldatei
- There is a directory in the root directory
home
, underneathbenutzer
, and there isbeispieldatei
.
- The Unix path alone does not indicate which physical data carrier
beispieldatei
is on.
Absolute and relative path names
From the operating system perspective, a path name is only unambiguous if it is fully specified as described above. In order to simplify operation and program development, it is possible on most systems to work with so-called relative path names . Individual components of a path name are omitted, e.g. B. the drive specification or part of the preceding directory list.
Examples of relative path names:
- Windows:
subdir\testfile
or.\autoexec.bat
or..\daten\tabelle1.xls
- Unix:
../lib/libXYZ.a
The operating system manages the current drive (Windows / Apple only) and the current directory as reference points for relative path names for each running program. Incomplete, "relative" path information is then interpreted based on the current values.
Example (Windows):
- Current drive is
C:
- Current directory is
\privat\texte
- An access to the relative path
..\daten\tabelle1.xls
is thenC:\privat\texte
interpreted as starting fromC:\privat\texte\..\daten\tabelle1.xls
. The character string..
means a change to the higher-level directory. The resolved, simplified path name is thenC:\privat\daten\tabelle1.xls
. You can also call.\text1.txt
the path in this exampleC:\privat\texte\text1.txt
, as it.
always stands for the current directory.
- Instead of the drive letter, it has become common today to specify the names in UNC format and, instead of the drive letter, also to specify the server name in Windows systems. See also Uniform Naming Convention .
Standard path
Depending on the type and purpose of the files to be saved, they are stored in certain places within hierarchically structured directory trees by default. See, for example, initialization file # location .