dirname
Dirname returns the directory portion of a file path.
Dirname returns the directory portion of a file path.
Input
string
Parameters
None
Returns
string
Examples
Get the folder of a file path
Input
file_path = "/var/log/app/server.log"Template
{{ file_path | dirname }}Output
/var/log/appStrip the file from a relative path
Input
source_file = "src/handlers/users.go"Template
{{ source_file | dirname }}Output
src/handlersHow is this guide?