| 1 |
% Generated by roxygen2: do not edit by hand |
| 2 |
% Please edit documentation in R/is.R |
| 3 |
\name{is_file} |
| 4 |
\alias{is_file} |
| 5 |
\alias{is_dir} |
| 6 |
\alias{is_link} |
| 7 |
\alias{is_file_empty} |
| 8 |
\title{Functions to test for file types} |
| 9 |
\usage{ |
| 10 |
is_file(path, follow = TRUE) |
| 11 |
|
| 12 |
is_dir(path, follow = TRUE) |
| 13 |
|
| 14 |
is_link(path) |
| 15 |
|
| 16 |
is_file_empty(path, follow = TRUE) |
| 17 |
} |
| 18 |
\arguments{ |
| 19 |
\item{path}{A character vector of one or more paths.} |
| 20 |
|
| 21 |
\item{follow}{If \code{TRUE}, symbolic links will be followed (recursively) and |
| 22 |
the results will be that of the final file rather than the link.} |
| 23 |
} |
| 24 |
\value{ |
| 25 |
A named logical vector, where the names give the paths. If the given |
| 26 |
object does not exist, \code{NA} is returned. |
| 27 |
} |
| 28 |
\description{ |
| 29 |
Functions to test for file types |
| 30 |
} |
| 31 |
\examples{ |
| 32 |
\dontshow{.old_wd <- setwd(tempdir())} |
| 33 |
dir_create("d") |
| 34 |
|
| 35 |
file_create("d/file.txt") |
| 36 |
dir_create("d/dir") |
| 37 |
link_create(path(path_abs("d"), "file.txt"), "d/link") |
| 38 |
|
| 39 |
paths <- dir_ls("d") |
| 40 |
is_file(paths) |
| 41 |
is_dir(paths) |
| 42 |
is_link(paths) |
| 43 |
|
| 44 |
# Cleanup |
| 45 |
dir_delete("d") |
| 46 |
\dontshow{setwd(.old_wd)} |
| 47 |
} |
| 48 |
\seealso{ |
| 49 |
\code{\link[=file_exists]{file_exists()}}, \code{\link[=dir_exists]{dir_exists()}} and \code{\link[=link_exists]{link_exists()}} if you want |
| 50 |
to ensure that the path also exists. |
| 51 |
} |