\HeaderA{file\_test}{Shell-style Tests on Files}{file.Rul.test}
\keyword{file}{file\_test}
\begin{Description}\relax
Utility for shell-style file tests.
\end{Description}
\begin{Usage}
\begin{verbatim}
file_test(op, x, y)
\end{verbatim}
\end{Usage}
\begin{Arguments}
\begin{ldescription}
\item[\code{op}] a character string specifying the test to be performed.
Unary tests (only \code{x} is used) are \code{"-f"} (existence and
not being a directory), \code{"-d"} (existence and directory) and
\code{"-x"} (executable as a file or searchable as a directory). 
Binary tests are \code{"-nt"} (strictly newer than, using the modification
dates) and \code{"-ot"} (strictly older than): in both cases the
test is false unless both files exist.
\item[\code{x,y}] character vectors giving file paths.
\end{ldescription}
\end{Arguments}
\begin{Details}\relax
\sQuote{Existence} here means being on the file system and accessible
by the \code{stat} system call (or a 64-bit extension) -- on a
Unix-alike this requires execute permission on all of the directories in
the path that leads to the file, but no permissions on the file
itself.
\end{Details}
\begin{SeeAlso}\relax
\code{\LinkA{file.exists}{file.exists}} which only tests for existence
(\code{test -e} on some systems) but not for not being a directory.

\code{\LinkA{file.path}{file.path}}, \code{\LinkA{file.info}{file.info}}
\end{SeeAlso}
\begin{Examples}
\begin{ExampleCode}
dir <- file.path(R.home(), "library", "stats")
file_test("-d", dir)
file_test("-nt", file.path(dir, "R"), file.path(dir, "demo"))
\end{ExampleCode}
\end{Examples}

