Help Centre › Functions & Formulas
For a full list of available calculation functions, please read What calculation functions are supported.
Description
The DIRNAME function extracts the parent directory from a given file path. This is useful for file management tasks where you need to navigate or manipulate directory structures.
Syntax
DIRNAME(file_path)
The DIRNAME function syntax has the following arguments:
- file_path Required. The full file path from which you want to extract the parent directory.
Example
| Formula | Description | Result |
| =DIRNAME("/home/user/documents/file.txt") | Extracts the parent directory from the given file path. | /home/user/documents |
| =DIRNAME("C:\\Users\\User\\Desktop\\image.png") | Extracts the parent directory from the given Windows file path. | C:\Users\User\Desktop |
| =DIRNAME({filePath}) | Assuming {filePath} contains "/var/log/system.log", this extracts the parent directory. | /var/log |
Errors
For a full list of formula errors, please read Formula errors.