Get the path without filename from a path.
dirname relative/path/file.txt # relative/path
To get only the filename check basename.
TIP
If using fish, you may also use path dirname.
fish
path dirname