macOS / binaries /

dirname

/usr/bin/dirname
Strip last component from file name

Output each NAME with its last non-slash component and trailing slashes removed.

source: man7.org