Internet
Fact-checked

At EasyTechJunkie, we're committed to delivering accurate, trustworthy information. Our expert-authored content is rigorously fact-checked and sourced from credible authorities. Discover how we uphold the highest standards in providing you with reliable knowledge.

Learn more...

What is a Pathname?

M.R. Anglin
M.R. Anglin

A pathname is a name that a computer uses to locate a file a user wants to access. Each component in the pathname refers to a folder or directory. When a user gives a name to a file, that filename is the last entry in the pathname. Pathnames are hierarchical in nature—starting with the root directory and going down each file and folder to reach the file the user wishes to access. This way, when the user wants to access a file, the computer can trace the path from the root directory and to the file the user wishes to access.

In general, the first component in a pathname is the root directory. On many computers, the root directory will give the drive letter also. For example, if the root directory is referring to the hard disk drive, the root directory will be C:/, where “C” is the drive letter. Drive letters will vary depending on what drive the user wants to access. If a person wishes to find a file in a flash drive, the root directory will be whatever letter is delineated to the flash drive.

Woman doing a handstand with a computer
Woman doing a handstand with a computer

After the root directory, the pathname contains all other folders that the computer will have to go through in order to find the specified file name. For example, if a user is looking for a file with the path, C:/documentsandsettings/user/pic.png, the computer will have to look in the C drive, under the folder “documentsandsettings” under the folder, “user,” and locate the filename “pic.png.” On many computers, each directory name is separated by a forward slash (/) or a colon (:). However, some computer systems use a backward slash (\) or another delimiter. This hierarchy is also important to how Uniform Resource Locators (URLs) work.

A file can either have a full, also known as an absolute, pathname or a relative pathname. Full paths give the entire pathname and point the computer to the same location no matter what the working directory is. It is always given in reference to the root directory. A relative path gives only part of the pathname. This leaves the computer to “assume” that the file is in the same directory as the working directory.

For example, a full path may be given as follows: C:/documentsandsettings/user/mydocuments/writingfolder/pathnames.doc. Notice that the root directory starts the pathname. However, a relative path may be something like pathnames.doc. If the user is using the working directory, “writingfolder,” and if no other information is given, the computer will automatically search for the filename in the “writingfolder” directory. Thus, a relative path is given in relation to a working directory.

Discuss this Article

Post your comments
Login:
Forgot password?
Register:
    • Woman doing a handstand with a computer
      Woman doing a handstand with a computer