\Header{basename}{Manipulate File Paths}
\alias{dirname}{basename}
\keyword{file}{basename}
\begin{Description}\relax
\code{basename} removes all of the path up to the last path separator
(if any).

\code{dirname} returns the part of the \code{path} up to (but
excluding) the last path separator, or \code{"."} if there is no path
separator.\end{Description}
\begin{Usage}
\begin{verbatim}
basename(path)
dirname(path)
\end{verbatim}
\end{Usage}
\begin{Arguments}
\begin{ldescription}
\item[\code{path}] character vector, containing path names.
\end{ldescription}
\end{Arguments}
\begin{Details}\relax
For \code{dirname} tilde expansion is done: see the description of
\code{\Link{path.expand}}.

Trailing file separators are removed before dissecting the path,
and for \code{dirname} any trailing file separators are removed
from the result.\end{Details}
\begin{Value}
A character vector of the same length as \code{path}.  A zero-length
input will give a zero-length output with no error (unlike \R{} < 1.7.0).\end{Value}
\begin{SeeAlso}\relax
\code{\Link{file.path}}, \code{\Link{path.expand}}.\end{SeeAlso}
\begin{Examples}
\begin{ExampleCode}
basename(file.path("","p1","p2","p3", c("file1", "file2")))
dirname(file.path("","p1","p2","p3","filename"))
\end{ExampleCode}
\end{Examples}

