| 1 |
% Generated by roxygen2: do not edit by hand |
| 2 |
% Please edit documentation in R/access.R |
| 3 |
\name{file_access} |
| 4 |
\alias{file_access} |
| 5 |
\alias{file_exists} |
| 6 |
\alias{dir_exists} |
| 7 |
\alias{link_exists} |
| 8 |
\title{Query for existence and access permissions} |
| 9 |
\usage{ |
| 10 |
file_access(path, mode = "exists") |
| 11 |
|
| 12 |
file_exists(path) |
| 13 |
|
| 14 |
dir_exists(path) |
| 15 |
|
| 16 |
link_exists(path) |
| 17 |
} |
| 18 |
\arguments{ |
| 19 |
\item{path}{A character vector of one or more paths.} |
| 20 |
|
| 21 |
\item{mode}{A character vector containing one or more of 'exists', 'read', |
| 22 |
'write', 'execute'.} |
| 23 |
} |
| 24 |
\value{ |
| 25 |
A logical vector, with names corresponding to the input \code{path}. |
| 26 |
} |
| 27 |
\description{ |
| 28 |
\itemize{ |
| 29 |
\item \code{file_exists(path)} is a shortcut for \code{file_access(x, "exists")} |
| 30 |
\item \code{dir_exists(path)} and \code{link_exists(path)} are similar but also check that |
| 31 |
the path is a directory or link, respectively. (\code{file_exists(path)} returns |
| 32 |
\code{TRUE} if \code{path} exists and it is a directory. Use \code{\link[=is_file]{is_file()}} to check for |
| 33 |
file (not directory) existence) |
| 34 |
} |
| 35 |
} |
| 36 |
\details{ |
| 37 |
\strong{Cross-compatibility warning:} There is no executable bit on |
| 38 |
Windows. Checking a file for mode 'execute' on Windows, e.g. |
| 39 |
\code{file_access(x, "execute")} will always return \code{TRUE}. |
| 40 |
} |
| 41 |
\examples{ |
| 42 |
file_access("/") |
| 43 |
file_access("/", "read") |
| 44 |
file_access("/", "write") |
| 45 |
|
| 46 |
file_exists("WOMBATS") |
| 47 |
} |