\HeaderA{files2}{Manipulaton of Directories and file Permissions}{files2}
\aliasA{dir.create}{files2}{dir.create}
\aliasA{Sys.chmod}{files2}{Sys.chmod}
\aliasA{Sys.umask}{files2}{Sys.umask}
\keyword{file}{files2}
\begin{Description}\relax
These functions provide a low-level interface to the computer's
file system.
\end{Description}
\begin{Usage}
\begin{verbatim}
dir.create(path, showWarnings = TRUE, recursive = FALSE, mode = "0777")
Sys.chmod(paths, mode = "0777")
Sys.umask(mode = "0000")
\end{verbatim}
\end{Usage}
\begin{Arguments}
\begin{ldescription}
\item[\code{path}] a character vector containing a single path name.
\item[\code{paths}] character vectors containing file or directory paths.
\item[\code{showWarnings}] logical; should the warnings on failure be shown?
\item[\code{recursive}] logical. Should elements of the path other than the
last be created?  If true, like Unix's \command{mkdir -p}.
\item[\code{mode}] the file mode to be used on Unix-alikes: it will be
coerced by \code{\LinkA{as.octmode}{as.octmode}}.
\end{ldescription}
\end{Arguments}
\begin{Details}\relax
\code{dir.create} creates the last element of the path, unless
\code{recursive = TRUE}.  Trailing path separators are removed.
The mode will be modified by the \code{umask} setting in the same way
as for the system function \code{mkdir}.  What modes can be set is
OS-dependent, and it is unsafe to assume that more than three octal
digits will be used.  For more details see your OS's documentation on the
system call \code{mkdir} (and not that on the command-line utility of
that name). 

\code{Sys.chmod} sets the file permissions of one or more files.
It may not be supported (when a warning is issued).
See the comments for \code{dir.create} for how modes are interpreted.
Changing mode on a symbolic link is unlikely to work (nor be
necessary).  For more details see your OS's documentation on the
system call \code{chmod} (and not that on the command-line utility of
that name). 

\code{Sys.umask} sets the \code{umask}.
It may not be supported (when a warning is issued and \code{"0000"}
returned).  For more details see your OS's documentation on the
system call \code{umask}.
\end{Details}
\begin{Value}
\code{dir.create} and \code{Sys.chmod} return invisibly a logical vector
indicating if the operation succeeded for each of the files attempted.
Using a missing value for a path name will always be regarded as a
failure.  \code{dir.create} indicates failure if the directory already
exists.  If \code{showWarnings = TRUE}, \code{dir.create} will give a
warning for an unexpected failure (e.g. not for a missing value nor
for an already existing component for \code{recursive = TRUE}).

\code{Sys.umask} returns the previous value of the \code{umask},
invisibly, as a length-one object of class \code{"\LinkA{octmode}{octmode}"}.
\end{Value}
\begin{Author}\relax
Ross Ihaka, Brian Ripley
\end{Author}
\begin{SeeAlso}\relax
\code{\LinkA{file.info}{file.info}}, \code{\LinkA{file.exists}{file.exists}}, \code{\LinkA{file.path}{file.path}},
\code{\LinkA{list.files}{list.files}}, \code{\LinkA{unlink}{unlink}},
\code{\LinkA{basename}{basename}}, \code{\LinkA{path.expand}{path.expand}}.
\end{SeeAlso}

