Path (computing)

From Wikipedia, the free encyclopedia

(Redirected from File path)
Jump to: navigation, search
For other meanings for this term, see Path

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, 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.

Contents

  Unix-like operating system DOS and descendant operating systems such as OS/2 and Microsoft Windows Japanese versions of DOS and Microsoft Windows Korean versions of DOS and Microsoft Windows Classic Mac OS and Mac OS X AmigaOS RISC OS
Parent-Child Direction Left-Right Left-Right Left-Right Left-Right Left-Right Left-Right Left-Right
Root Directory / [drive letter]:\ [drive letter]:\ (may display as [drive letter]:¥) [drive letter]:\ (may display as [drive letter]:₩) [drive name]: [drive, volume or assign name]: [fs type]::[drive number or disc name].$
Directory Separator / \ or / \ (may look like ¥) or / \ (may look like ₩) or /  : / .

Japanese version and Korean version Windows use the same code point as the other versions—U+005C in Unicode, or 0x5C in legacy code pages—as a path separator. However, it is sometimes changed from a backslash to a homoglyph of U+00A5 'YEN SIGN' ¥ in Japanese fonts, or of U+20A9 'WON SIGN' ₩ in Korean fonts, to make it easy to input the national currency symbol needed for practical purposes. (This does not mean that U+00A5 or U+20A9 may be used as a path separator.) The code point 0x5C is not in the invariant subset of ISO 646, and historically was mapped to YEN SIGN in Windows Codepage 932 (Japanese Shift JIS) [1], and to WON SIGN in Codepage 949 (Korean) [2] Also note that 0x5C may appear as a part of a multibyte character (typically the trailing byte of a double-byte character) in multibyte character sets, such as Japanese Shift JIS, when it must not be interpreted as a path separator.

On Unix-like operating systems, DOS and its descendants, PATH is an environment variable listing a set of paths to directories where executables may be found.

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:

\\ComputerName\SharedFolder\Resource

where 'ComputerName' is the hostname, 'SharedFolder' is a shared directory with a name chosen by the host providing the share, and 'Resource' is a shared directory, file, or printer. The hostname may also be identified by a fully-qualified domain name (FQDN) or by an IP address. The 'sharedfolder' may exist anywhere on the remote host system, and is not restricted to the filesystem root directory.

The "Long UNC" or "UNCW" format works with many - but not all - of the Windows 'W' ('W' suffix to the WinAPI routine, indicating wide, for wchar_t path names which are UCS-2 based) looks as follows:

\\?\UNC\ComputerName\SharedFolder\Resource

Unix-like systems occasionally use a similar syntax, with forward slashes ( / ) in place of backslashes ( \ ), but usually write the syntax as computername:/directory/resource [3] or, like URLs, for example smb://computername/sharedfolder.

The UNC method started with the UNIX operating system. UNIX systems use the forward-slash character as a path separator. Many network services such as FTP have their origins in the UNIX operating system, so they use forward-slashes instead of the backslashes that DOS/Windows uses. It is important to recognize this distinction when using these services.

The different types of paths in Windows are local file system (LFS), such as C:\File.ext, uniform naming convention (UNC), such as \\Server\Volume\File.ext, and Long UNC or UNCW, such as \\?\C:\File.ext or \\?\UNC\Server\Volume\File.ext.

One of the differences between LFS and UNC versus Long UNC is that LFS and UNC are limited, depending on the Windows version and/or individual API, to either 260 bytes in ACP format or 260 codepoints in UTF-16 format (or 260 characters in UCS-2 format). Long UNC is limited to 30,000+ codepoints in UTF-16 format (or 30,000+ characters in UCS-2 format) and must be in Unicode.

ACP stands for "ANSI Code Page", which is somewhat of a misnomer since none of the Windows code pages are actually ANSI compliant. The Windows operating system specifies a particular code page as the ACP, which then is used as the default / fallback code page for the 'A' suffixed path APIs. The ACP routines have the shortcoming in that they cannot represent all file paths that are representable in the operating system; they can only represent the character subset of Unicode UCS-2 paths which have characters in the particular code page's character set.

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.)

Here are some examples of MS-DOS/Windows style paths:

A:\Temp\car.jpg

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

C:..\Launch.avi

This pathname refers to a file called Launch.avi located in the parent directory of the current directory on drive C:.

Program Files\Viewer\viewer.exe

This pathname denotes a file called viewer.exe located in Viewer directory which in turn is located in Program Files directory which is located in the current directory of the current drive (since no drive specification is present in this example).

viewer.exe

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

This article was originally based on material from the Free On-line Dictionary of Computing, which is licensed under the GFDL.

Advanced Search
Included Web Search Engines


Safe Search

close

Top Matching Results

Occasionally Search.com will highlight specialized results that are based on the context of your query. Examples of specialized results include specific links to news, images, or video.

Top Matching Results may highlight information from other Search.com pages, content from the CNET Network of sites, or third party content. The listings are based purely on relevance. Search.com does not receive payment for listings in this section but our partners that provide this data may get paid for listing these products.

Sponsored Links

This section contains paid listings which have been purchased by companies that want to have their sites appear for specific search terms and related content. These listings are administered, sorted and maintained by a third party and are not endorsed by Search.com.

Search Results

Search.com sends your search query to several search engines at one time and integrates the results into one list which has been sorted by relevance using Search.com's proprietary algorithm. You can customize the list of search engines included in your metasearch from the preferences.

The search engines that are used in your metasearch may allow companies to pay to have their Web sites included within the results. To view the Paid Inclusion policy for a specific search engine, please visit their Web site. Search.com does not accept payment or share revenue with any search engine partner for listings in this section.