Home Absolute Path

    Absolute Path

    49

    (also known as a full path)

    The complete location of a file or directory within a computer filesystem. An absolute path starts at the root directory (or drive letter) and continues up the directory hierarchy until the specific file or directory is reached. This contrasts with a relative path, which does not start at the root directory.

    The syntax of absolute paths differs by the operating system. On Microsoft Windows, they begin with a drive letter and use a backslash to separate directory names. Absolute paths on macOS and Linux lack drive letters and use a forward slash as the directory separator.

    Examples:

    • Windows: C:UsersMattwwwblogimagesicecream.jpg
    • macOS: /Users/Matt/www/blog/images/icecream.jpg
    • Linux/home/Matt/www/blog/images/icecream.jpg

    To find the absolute filesystem path of the directory containing a web page, copy the code below into a new text file, save the file as path.php (thus making a simple PHP web page), and move that file to your web server. Then direct your web browser to the URL address of that file (e.g. http://www.example.com/path.php).

    <?php
    echo getcwd();
    ?>
    

    See also: Path (computing) at Wikipedia