\HeaderA{file.info}{Extract File Information}{file.info}
\keyword{file}{file.info}
\begin{Description}\relax
Utility function to extract information about files on the user's
file systems.
\end{Description}
\begin{Usage}
\begin{verbatim}
file.info(...)
\end{verbatim}
\end{Usage}
\begin{Arguments}
\begin{ldescription}
\item[\code{...}] character vectors containing file paths.
\end{ldescription}
\end{Arguments}
\begin{Details}\relax
The file paths are tilde-expanded: see \code{\LinkA{path.expand}{path.expand}}.

What is meant by \sQuote{file access} and hence the last access time
is system-dependent.

The file \sQuote{mode} follows POSIX conventions, giving three octal
digits summarizing the permissions for the file owner, the owner's
group and for anyone respectively.  Each digit is the logical
\emph{or} of read (4), write (2) and execute/search (1) permissions.

On most systems symbolic links are followed, so information is given
about the file to which the link points rather than about the link.
\end{Details}
\begin{Value}
A data frame with row names the file names and columns
\begin{ldescription}
\item[\code{size}] double: File size in bytes.
\item[\code{isdir}] logical: Is the file a directory?
\item[\code{mode}] integer of class \code{"octmode"}.  The file permissions,
printed in octal, for example \code{644}.
\item[\code{mtime, ctime, atime}] integer of class \code{"POSIXct"}:
file modification, \sQuote{last status change} and last access times.
\item[\code{uid}] integer: the user ID of the file's owner.
\item[\code{gid}] integer: the group ID of the file's group.
\item[\code{uname}] character: \code{uid} interpreted as a user name.
\item[\code{grname}] character: \code{gid} interpreted as a group name.
\end{ldescription}

Unknown user and group names will be \code{NA}.

Entries for non-existent or non-readable files will be \code{NA}.
The \code{uid}, \code{gid}, \code{uname} and \code{grname} columns
may not be supplied on a non-POSIX Unix system.

What is meant by the three file times depends on the OS and file
system.  On Windows \code{ctime} is the creation time.
\end{Value}
\begin{Note}\relax
Some (broken) systems allow files of more than 2Gb to be created but
not accessed by the \code{stat} system call.  Such files will show up
as non-readable (and very likely not be readable by any of \R's input
functions).
\end{Note}
\begin{SeeAlso}\relax
\code{\LinkA{files}{files}}, \code{\LinkA{file.access}{file.access}},
\code{\LinkA{list.files}{list.files}},
and \code{\LinkA{DateTimeClasses}{DateTimeClasses}} for the date formats.

\code{\LinkA{Sys.chmod}{Sys.chmod}} to change permissions.
\end{SeeAlso}
\begin{Examples}
\begin{ExampleCode}
ncol(finf <- file.info(dir()))# at least six
## Not run: finf # the whole list
## Those that are more than 100 days old :
finf[difftime(Sys.time(), finf[,"mtime"], units="days") > 100 , 1:4]

file.info("no-such-file-exists")
\end{ExampleCode}
\end{Examples}

