# Path

The functions for manipulating filename paths are described here.

* [AbsPath( str path ) str](/stdlib/path.md#abspath-str-path-str)
* [BaseName( str path ) str](/stdlib/path.md#basename-str-path-str)
* [Dir( str path ) str](/stdlib/path.md#dir-str-path-str)
* [Ext( str path ) str](/stdlib/path.md#ext-str-path-str)
* [JoinPath( str path... ) str](/stdlib/path.md#joinpath-str-path-str)
* [MatchPath( str pattern, str path ) bool](/stdlib/path.md#matchpath-str-pattern-str-path-bool)
* [Path( finfo fi ) str](/stdlib/path.md#path-finfo-fi-str)

## Functions

### AbsPath(str path) str

The *AbsPath* function returns an absolute representation of path.

### BaseName(str path) str

The *BaseName* function returns the last element of path. Trailing path separators are removed before extracting the last element. If the path is empty, the function returns ".".

### Dir(str path) str

The *Dir* function returns all but the last element of path, typically the path's directory.

### Ext(str path) str

The *Ext* function returns the file name extension. The result extension is without a dot.

### JoinPath(str path...) str

The *JoinPath* function joins any number of path elements into a single path, adding a separator if necessary.

### MatchPath(str pattern, str path) bool

The *MatchPath* function checks if the given name matches the specified pattern. The function checks the pattern completely for the specified path, not for the substring. You can use a regular expression as a pattern. To do this, add a */* at the beginning and end.

* '\*' - matches any sequence of non-separator characters
* '?' - matches any single non-separator character

```
MatchPath(`*.txt`, `myfile.txt`)       // true
MatchPath(`?a?.pdf`, `1ab.pdf`)        // true
MatchPath(`/home/ak/my.pdf`, `*.pdf`)         // false
MatchPath(`/home/ak/my.pdf`, `/home/*/my.*`)  // true
MatchPath(`/home/ak/my.pdf`, `/home/*/my.*`) // true
MatchPath(`/user/`, `/home/user/myfile`) // true
```

### Path(finfo fi) str

The *Path* function concatenates the *Name* and *Dir* fields of the *finfo* variable and returns the resulting path.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.gentee.org/stdlib/path.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
