# path.extractPath

Function · category: Other

Source: https://github.com/playcanvas/engine/blob/970d89f6d3bc6667f4e1f88153abd6e7e82ed52c/src/core/path.js#L180

```ts
extractPath(pathname: string): string
```

Return the path without file name. If path is relative path, start with period.

**Parameters**

- `pathname` (`string`): The full path to process.

**Returns** `string`: The path without a last element from list split by slash.

**Example**

```ts
path.extractPath("path/to/file.txt");    // returns "./path/to"
path.extractPath("./path/to/file.txt");  // returns "./path/to"
path.extractPath("../path/to/file.txt"); // returns "../path/to"
path.extractPath("/path/to/file.txt");   // returns "/path/to"
```
