\
Introduction
Absolute & Relative File or Directory Names
Absolute & Relative File or Directory Names |
There are two types of folders and files as follows:
- An absolute filename contains a drive (or UNC server name) as well
as a path so that the location is fully qualified.
For example with "C:\TMP\SomeFile.txt",
you know that "SomeFile.txt" is in the "C:\TMP" folder.
- A relative filename on the other hand is missing drive or
folder information and so its alsolute filename is dependant on the
Current Directory or Drive.
Without knowing the current directory/folder you can't tell where
the file is, some examples:
- C:\SomeFile.txt
- \TMP\SomeFile.txt
- ..\SomeFile.txt
- SomeFile.txt
There are some special folder names that have specific meanings in
relative paths:
- .. (dot dot)
This represents the previous (higher level) directory, the following
filenames refer to the same file:
- SomeFile.txt
- SUBDIR\..\SomeFile.txt
- ..\SomeFile.txt (when in "C:\TMP\SUBDIR")
- . (single dot)
This represents the current directory, the following two filenames
refer to the same file:
- SomeFile.txt
- .\SomeFile.txt
This Naming Files, Paths, and Namespaces
page has some very useful file related information
(including what the "\\?\" file prefix does
(allow you to handle very long paths).