How To Find Out The Absolute Path To A File

Table of contents:

How To Find Out The Absolute Path To A File
How To Find Out The Absolute Path To A File

Video: How To Find Out The Absolute Path To A File

Video: How To Find Out The Absolute Path To A File
Video: ✅ HTML File Paths Tutorials | Master Relative File Paths and Absolute File Paths 2024, December
Anonim

If you often have to deal with all kinds of scripts, sooner or later the task of specifying the exact address of the file to be passed to the program will arise. This is most often done using an absolute address. An "absolute" or "full" file path is a string variable that contains an enumeration of all nested folders along the path from the root directory to this file.

How to find out the absolute path to a file
How to find out the absolute path to a file

Instructions

Step 1

If you need to find out the absolute path to a file stored on a computer running Windows, you can do this using the file manager of this system - Explorer. Open it by double-clicking the "My Computer" icon on your desktop or by selecting a similar item from the main "Start" menu. Another way is to use the Win and E keyboard shortcut.

Step 2

Navigate the folder tree in the left frame of Explorer to the directory containing the file you need. Select and copy (Ctrl + C) the contents of the file manager's address bar - this is the full path to the folder storing the file. If you are using Windows 7, then the address bar of Explorer will contain the path to the file in a form that is convenient for use, but does not comply with the standard. To bring it to the standard form, left-click anywhere on the space of the address bar free of inscriptions - this will be enough for the application to display the path as needed and select it, and you just need to copy the selected one.

Step 3

Paste the copied path into any page open in any text editor. It will indicate the full address of the folder, but not the file - add the file name, including the extension, separating it from the inserted line with a backslash (). In order not to be mistaken, the file name can also be copied in Explorer. To do this, click it once with the mouse, press the f2 function key, then the ctrl + c key combination, and exit the name editing mode by pressing the Esc key.

Step 4

On Unix systems, instead of a backslash (), use the regular (/) to separate folders when specifying a file address. Most often, the need to find out the full path to a file on computers running under the Unix OS arises to use this file by server-side scripts used in Internet programming. In such cases, you can use the functionality of the corresponding programming language. For example, in PHP, the full path to the executable file contains an environment variable named script_filename ($ _SERVER ['SCRIPT_FILENAME']).

Recommended: