basename
function removes all of the given path up
to the last path separator.
It can also remove a specified filename suffix.
The
dirname
function returns the part of the given path
up to, but not including, the last path separator.
It returns "." if there is no path separator in the path.
basename(path, suffix) dirname(path)
path.
path
,
containing either the final filenames
(basename)
or
the path up the final filenames
(dirname).
Trailing file separators are always removed before operating on the
path and trailing file separators are not returned by
dirname.
.
These functions are similiar to the command line utilities by the same name in Unix/Linux.
dirname("/users/bob/data/salmon.csv") basename("/homes/larry/help/lreg.Rd", suffix=".Rd")