Category: 

What is a Pathname?

Article Details
  • Written By: M.R. Anglin
  • Edited By: Bronwyn Harris
  • Last Modified Date: 09 September 2016
  • Copyright Protected:
    2003-2016
    Conjecture Corporation
  • Print this Article
Free Widgets for your Site/Blog
Built at the request of Dag Hammarskjöld, the United Nations Headquarters has a meditation room dedicated to silence.   more...

October 1 ,  1890 :  Yosemite National Park was established.  more...

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.

Ad

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.

Ad

You might also Like

Recommended

Discuss this Article

Post your comments

exception 'Exception' with message 'error writing captcha: Duplicate entry '2147483647' for key 'PRIMARY'' in /ssd/www/wisegeek/public_html/_core/classes/public/Captcha.php:44
Stack trace:
#0 /ssd/www/wisegeek/public_html/_core/controls/public/ControlDiscussionPostBox.php(324): Captcha->createCaptcha()
#1 /ssd/www/wisegeek/public_html/framework/classes/Control.php(104): ControlDiscussionPostBox->preRender(false)
#2 /ssd/www/wisegeek/public_html/framework/classes/Control.php(149): Control->render()
#3 /ssd/www/wisegeek/public_html/tpl/default-nocustom-lu/pages/public/article/article.htm(526): Control->__toString()
#4 /ssd/www/wisegeek/public_html/framework/classes/Control.php(300): require('/ssd/www/wisege...')
#5 /ssd/www/wisegeek/public_html/framework/classes/Control.php(309): Control->requireTpl('pages/public/ar...', Object(PageArticleCom), true)
#6 /ssd/www/wisegeek/public_html/framework/classes/Control.php(131): Control->renderTpl('pages/public/ar...', Object(PageArticleCom))
#7 /ssd/www/wisegeek/public_html/framework/classes/FormDataControl.php(87): Control->renderTemplate()
#8 /ssd/www/wisegeek/public_html/framework/classes/Control.php(109): FormDataControl->renderTemplate()
#9 /ssd/www/wisegeek/public_html/framework/classes/ScriptPage.php(50): Control->render(false)
#10 /ssd/www/wisegeek/public_html/framework/classes/Control.php(149): ScriptPage->render()
#11 /ssd/www/wisegeek/public_html/framework/classes/Page.php(97): Control->__toString()
#12 /ssd/www/wisegeek/public_html/_core/classes/public/PublicFrontController.php(443): Page->processRequest()
#13 /ssd/www/wisegeek/public_html/_core/classes/public/PublicFrontController.php(7): PublicFrontController->renderPage()
#14 /ssd/www/wisegeek/public_html/index.php(11): PublicFrontController::run()
#15 {main}