# ansible.builtin.basename
Returns the last name component of a path, what is left in the string that is not ‘dirname’.

## Examples
```yml
# To get the last name of a file path, like 'foo.txt' out of '/etc/asdf/foo.txt'.
{{ mypath | basename }}
```