% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/RcppExports.R
\name{vsi_read_dir}
\alias{vsi_read_dir}
\title{Read names in a directory}
\usage{
vsi_read_dir(path, max_files = 0L, recursive = FALSE, all_files = FALSE)
}
\arguments{
\item{path}{Character string. The relative or absolute path of a
directory to read.}

\item{max_files}{Integer scalar. The maximum number of files after which to
stop, or 0 for no limit (see Note). Ignored if \code{recursive = TRUE}.}

\item{recursive}{Logical scalar. \code{TRUE} to read the directory and its
subdirectories. Defaults to \code{FALSE}.}

\item{all_files}{Logical scalar. If \code{FALSE} (the default), only the names
of visible files are returned (following Unix-style visibility, that is
files whose name does not start with a dot). If \code{TRUE}, all file names
will be returned.}
}
\value{
A character vector containing the names of files and directories
in the directory given by \code{path} (may be an empty vector \code{character(0)}).
The listing is in alphabetical order, and does not include the special
entries '.' and '..' even if they are present in the directory. An empty
vector (\code{character(0)}) is returned if \code{path} does not exist.
}
\description{
\code{vsi_read_dir()} abstracts access to directory contents. It returns a
character vector containing the names of files and directories in this
directory. With \code{recursive = TRUE}, reads the list of entries in the
directory and subdirectories.
This function is a wrapper for \code{VSIReadDirEx()} and \code{VSIReadDirRecursive()}
in the GDAL Common Portability Library.
}
\note{
If \code{max_files} is set to a positive number, directory listing will stop
after that limit has been reached. Note that to indicate truncation, at
least one element more than the \code{max_files} limit will be returned. If the
length of the returned character vector is lesser or equal to \code{max_files},
then no truncation occurred. The \code{max_files} parameter is ignored when
\code{recursive = TRUE}.
}
\examples{
# regular file system for illustration
data_dir <- system.file("extdata", package="gdalraster")
vsi_read_dir(data_dir)
}
\seealso{
\code{\link[=vsi_glob]{vsi_glob()}}, \code{\link[=vsi_mkdir]{vsi_mkdir()}}, \code{\link[=vsi_rmdir]{vsi_rmdir()}}, \code{\link[=vsi_stat]{vsi_stat()}}, \code{\link[=vsi_sync]{vsi_sync()}}
}
