dirname

dirname strips last component from file name

dirname toto
dirname titi/toto
dirname /tmp/toto