dirname
and basename
, referring to the path with the trailing component removed, and the trailing component respectively?In particular, alternatives used on major operating systems or libraries are of interest.
The terms dirname
and basename
seem quite straightforward, i.e. "directory name" and "base name within the directory", so I don't think there is any specific reason for these names.
I'm not sure what you mean by "Is the terminology standardized". The calls are part of the POSIX standard (dirname, basename) but they've also been borrowed by many high-level languages like PHP (dirname, basename), Perl and Python.
Other equivalents:
On Windows, the shell API provides the PathRemoveFileSpec
and PathStripPath
functions, which are similar to dirname
and basename
.
In Java, the File class provides getParent
and getName
which do the same thing.