Path (computing)

Path (computing)

A path is the general form of a file or directory name, giving a file's name and its unique location in a file system. Paths point to their location using a string of characters signifying directories, each path component separated by a delimiting character, most commonly the slash "/" or backslash character "", or colon ":" though some operating systems may use a different delimiter. Paths are used extensively in computer science to represent the directory/file relationships common in modern operating systems, and are essential in the construction of Uniform Resource Locators (URLs).

A path can be either absolute or relative. A full path or absolute path is a path that points to the same location on one file system regardless of the working directory or combined paths. It is usually written in reference to a root directory.

A relative path is a path relative to the current working directory, so the full absolute path may not need to be given.

Representations of paths by operating system and shell

On Japanese and Korean versions of Windows it may often look like the '¥' character or the '' character is the path separator. This is not true however, instead the code for backslash is being drawn as these characters. Very early versions of MS-DOS replaced the backslash with these glyphs on the display to make it possible to display them by programs that only understood 7-bit ASCII (other characters such as the square brackets were replaced as well, see ISO 646, [ Windows Codepage 932 (Japanese Shift JIS)] , and [ Codepage 949 (Korean)] ). This predates the addition of paths in MS-DOS 2 and is a good indication that Microsoft never intended backslash to be the path separator, as a normal slash would display correctly. Although even the first version of Windows supported the 8-bit ISO-8859-1 character set which has the Yen sign at U+00A5, and modern versions of Windows supports Unicode which has the Won sign at U+20A9, much software will continue to display backslashes found in ASCII files this way to preserve backwards compatibility.

Mac OS X is UNIX-based and thus uses UNIX paths internally. However, to preserve compatibility for software and familiarity for users, many portions of the GUI switch "/" typed by the user to ":" internally, and switch them back when displaying filenames (a ":" entered by the user is also changed into "-" but the inverse translation does not happen).

Uniform Naming Convention

The UNC, short for Universal Naming Convention or Uniform Naming Convention, specifies a common syntax to describe the location of a network resource, such as a shared file, directory, or printer. The UNC syntax for Windows systems is as follows:


Note: The UNC syntax is sometimes written with forward slashes. In Windows the forward slashes and back slashes are equivalent, but many programs will accept only backward slashes, and some will only accept double backslashes (ie \\ComputerName\SharedFolder), especially in quoted string constants, due to the standard use of backslash as an escape character.

The "SharedFolder" is not necessarily the same as what a program on the server would see if it tried to open "SharedFolder". Instead it is an arbitrary name assigned to the folder when it was "shared".

Unix-like systems occasionally use a similar syntax, but a POSIX requirement that double slashes must be treated as single slashes breaks this.Fact|date=April 2008 More often this syntax is used: [ [ UNC Definition: TechEncyclopedia from TechWeb] ]


or, like URLs with the service name:


Some Windows APIs also accept the "Long UNC":


The different types of paths in Windows are local file system (LFS), such as C:File, uniform naming convention (UNC), such as \ServerVolumeFile, and Long UNC or UNCW, such as \?C:File or \?UNCServerVolumeFile. In earlier versions of Windows only the API's that accept "Long UNC" would accept more than 260 characters. This has been fixed in recent versions.


Unix style

Here is an example with a Unix style file system as it would appear from a terminal or terminal application (command-line window):

Your current working directory (cwd) is: /users/mark/

You want to change your current working directory to: /users/mark/bobapples

At that moment, the relative path for the directory you want is: ./bobapples

and the absolute path for the directory you want is /users/mark/bobapples

Because "bobapples" is the relative path for the directory you want, you may type the following at the command prompt to change your current working directory to bobapples: cd bobapples

Two dots ("..") are used for moving up in the hierarchy, to indicate the parent directory; one dot (".") represents the directory itself. Both can be components of a complex relative path (e.g., "../mark/./bobapples"), where "." alone or as the first component of such a relative path represents the working directory. (Using "./foo" to refer to a file "foo" in the current working directory can sometimes be useful to distinguish it from a resource "foo" to be found in a default directory or by other means; for example, to view a specific version of a man page instead of the one installed in the system.)

MS-DOS/Microsoft Windows style

Contrary to popular belief, the Windows system API accepts slash, and thus all the above Unix examples should work. But many applications on Windows interpret a slash for other purposes or treat it as an invalid character, and thus require you to enter backslash. One of the prime examples is the cmd.exe shell (often called the "terminal" as it is typically run in a terminal window). Note that many other shells available for Windows, such as tcsh and Windows PowerShell, allow the forward slash.

In addition "" does not indicate a single root, but instead the root of the "current disk". Indicating a file on a disk other than the current one requires prefixing a drive letter and colon. This is not ambiguous because colon is not a valid character in an MS-DOS filename, and thus you cannot have a file called "A:" in your current directory.

Here are some examples of MS-DOS/Windows style paths, with backslashes used to match the most common syntax:


This path points to a file whose name is File, which is located in the directory Temp, which in turn is located in the root directory of the drive A:.


This path refers to a file called File located in the parent directory of the current directory on drive C:.


This path denotes a file called File located in SubFolder directory which in turn is located in Folder directory which is located in the current directory of the current drive (since no drive specification is present in this example).


This rather simple path points to a file named File located in the current directory (since no directory specification is present) on the current drive (since no drive specification is present).


This path refers to the first serial port (COM1).

ee also

* Filename
* Uniform Resource Locator (URL)
* Device file
* basename
* Path (variable)


External links

* [ Path Definition] - by The Linux Information Project (LINFO)

Wikimedia Foundation. 2010.

См. также в других словарях:

  • Path — PathPath may also refer to:*Course (navigation), the intended path of a vehicle over the surface of the Earth *Trail, footpath, or bicycle way in rural or urban settings *Sidewalk running along the edge of a road, in some varieties of English… …   Wikipedia

  • Path MTU discovery — (PMTUD) is a technique in computing for determining the maximum transmission unit (MTU) size on the network path between two IP hosts with a view to avoiding IP fragmentation. Path MTU discovery works by setting the DF (Don t Fragment) option bit …   Wikipedia

  • Path analysis — may mean:* Path analysis (statistics), a statistical method of finding cause/effect relationships * Path analysis (computing), a method for finding the trail that leads users to websites * Critical Path Method, an operations research technique …   Wikipedia

  • Path analysis (computing) — Path analysis, in Internet website analytics, is a process of determining a sequence of pages visited in a visitor session prior to some desired event, such as the visitor purchasing an item or requesting a newsletter. The precise order of pages… …   Wikipedia

  • Path computation element — Routing is the process of finding a suitable route for conveying data between a source and one or a set of destination. Routing can be subject to a set of constraints, like QoS, policy, or price. Constraint based path computation is a strategic… …   Wikipedia

  • path */*/*/ — UK [pɑːθ] / US [pæθ] noun [countable] Word forms path : singular path plural paths UK [pɑːðz] / US [pæðz] 1) a) a way from one place to another that people can walk along a steep mountain path path through: A short path through the woods leads to …   English dictionary

  • Path decomposition — In graph theory, a path decomposition of a graph G is a tree decomposition (X,T) where T is a path. The path width of G is the least integer k such that G has a path decomposition of width k.Computing the path width of a graph is NP hard …   Wikipedia

  • Computing Technology Industry Association — The Computing Technology Industry Association (CompTIA), a non profit trade association, was created in 1982 as the Association of Better Computer Dealers, Inc. (ABCD) by representatives of five microcomputer dealerships. Over the course of a… …   Wikipedia

  • Trusted Computing — (TC) is a technology developed and promoted by the Trusted Computing Group. The term is taken from the field of trusted systems and has a specialized meaning. With Trusted Computing the computer will consistently behave in specific ways, and… …   Wikipedia

  • Reconfigurable computing — is a computer architecture combining some of the flexibility of software with the high performance of hardware by processing with very flexible high speed computing fabrics like field programmable gate arrays (FPGAs). The principal difference… …   Wikipedia

Поделиться ссылкой на выделенное

Прямая ссылка:
Нажмите правой клавишей мыши и выберите «Копировать ссылку»