Path Definition

Path Definition

Path Definition

In the real world, paths are trails or streets than lead to a certain location. Similarly, in the computer world, a path defines the location of a file or folder in a computer’s file system. Paths are also called “directory paths” because they often include one or more directories that describe the path to the file or folder.

A path can either be relative or absolute. A relative path defines a location that is relative to the current directory or folder. For example, the relative path to a file named “document.txt” located in the current directory is simply the filename, or “document.txt”. If the file was stored inside a folder named “docs” within the directory, the relative path would be “docs/document.txt.” If the file was located one folder up from the current directory, the relative path would be defined as “../document.txt”.

Absolute paths are defined from the root directory of the file system. This means no matter what folder is currently open, the absolute path to any given file is the same. Some examples of root paths include “/” for a Unix root directory, “/Applications/Preview.app” for a Mac OS X application, and “C:\Documents and Settings\All Users\Applicaton Data” for the Windows application settings. As you can see, Macintosh and Unix systems use forward slashes ( / ) to identify path directories, while Windows uses backslashes ( \ ). Regardless of the syntax, paths are a simple way to describe the location of folders and files.