dirname

In a string containing slashes, the basename is everything preceding the last slash.