How To Specify A Directory

Table of contents:

How To Specify A Directory
How To Specify A Directory

Video: How To Specify A Directory

Video: How To Specify A Directory
Video: Camstudio Basics - How to specify a directory to save camstudio recordings 2024, May
Anonim

Most often, the need to specify the path to a folder arises when creating scripts or applications. The rules for writing the path to the directory in this case depend on the programming language used and the type of operating system. In addition, there are two possible forms of recording the directory address - absolute and relative.

How to specify a directory
How to specify a directory

Instructions

Step 1

Use the Windows file manager to copy the absolute path to the desired directory - this immeasurably reduces the chance of mistakes, compared to manual typing. File Explorer is launched by pressing the WIN + E keyboard shortcut or by double-clicking the My Computer shortcut on the desktop. Having opened the necessary folder in it, select and copy to the clipboard (CTRL + C) the full path to this directory contained in the address bar. Then you can use the contents of the clipboard at your discretion.

Step 2

Use PHP's built-in dirname function to get the full path to a directory on the web server. The simplest way to use it can be written like this:

A PHP script with such content should be placed in the directory, the path to which you are interested in. By entering the http-address of this script into the address bar of the browser and pressing the Enter key, you will run it, and the script will display the full path to the directory on an empty page. From here it can be copied and further used for its intended purpose.

Step 3

Start specifying the full path to the directory with a drive letter if you have to type it manually. After the letter there should be a colon, and then you need to list through a backslash (in the case of Windows OS) all the folders on the path to the desired directory, starting from the root. For example:

C: / Program Files / Avira / keys \

Step 4

Replace the drive letter with a double backslash if the desired directory is located on one of the resources connected over the local network. For example:

OtherComp / SharedDocs \

Step 5

Use forward slashes instead of backslashes when specifying paths to folders on Unix systems. For example:

/ home / someFolder /

Step 6

Use the abbreviated notation of the path to folders if you need to specify its position relative to another folder (relative path). The relative path considers the root folder to be the one containing the document referring to the required folder. For example, if a web page is located in the home folder, and you need to register the path to the images folder nested in home, then you just need to specify images / in the relative path.

Recommended: