vsi_read_dir()
abstracts access to directory contents. It returns a
character vector containing the names of files and directories in this
directory. With recursive = TRUE
, reads the list of entries in the
directory and subdirectories.
This function is a wrapper for VSIReadDirEx()
and VSIReadDirRecursive()
in the GDAL Common Portability Library.
vsi_read_dir(path, max_files = 0L, recursive = FALSE, all_files = FALSE)
A character vector containing the names of files and directories
in the directory given by path
. The listing is in alphabetical order, and
does not include the special entries '.' and '..' even if they are present
in the directory. An empty string (""
) is returned if path
does not
exist.
Character string. The relative or absolute path of a directory to read.
Integer scalar. The maximum number of files after which to
stop, or 0 for no limit (see Note). Ignored if recursive = TRUE
.
Logical scalar. TRUE
to read the directory and its
subdirectories. Defaults to FALSE
.
Logical scalar. If 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 TRUE
, all file names
will be returned.
vsi_mkdir()
, vsi_rmdir()
, vsi_stat()
, vsi_sync()
# regular file system for illustration
data_dir <- system.file("extdata", package="gdalraster")
vsi_read_dir(data_dir)
Run the code above in your browser using DataLab