| dir_ls {fs} | R Documentation |
dir_ls() is equivalent to the ls command. It returns filenames as a
fs_path character vector.
dir_info() is equivalent to ls -l and a shortcut for
file_info(dir_ls()).
dir_map() applies a function fun() to each entry in the path and returns
the result in a list.
dir_walk() calls fun for its side-effect and returns the input path.
dir_ls(path = ".", all = FALSE, recursive = FALSE, type = "any", glob = NULL, regexp = NULL, invert = FALSE, fail = TRUE, ...) dir_map(path = ".", fun, all = FALSE, recursive = FALSE, type = "any", fail = TRUE) dir_walk(path = ".", fun, all = FALSE, recursive = FALSE, type = "any", fail = TRUE) dir_info(path = ".", all = FALSE, recursive = FALSE, type = "any", regexp = NULL, glob = NULL, fail = TRUE, ...)
path |
A character vector of one or more paths. |
all |
If |
recursive |
Should directories be listed recursively? the filenames. |
type |
File type(s) to return, one or more of "any", "file", "directory", "symlink", "FIFO", "socket", "character_device" or "block_device". |
glob |
A wildcard aka globbing pattern (e.g. |
regexp |
A regular expression (e.g. |
invert |
If |
fail |
Should the call fail (the default) or warn if a file cannot be accessed. |
... |
Additional arguments passed to grep. |
fun |
A function, taking one parameter, the current path entry. |
dir_ls(R.home("share"), type = "directory")
# Create a shorter link
link_create(system.file(package = "base"), "base")
dir_ls("base", recursive = TRUE, glob = "*.R")
dir_map("base", identity)
dir_walk("base", str)
dir_info("base")
# Cleanup
link_delete("base")