dir_ls | R Documentation |
dir_ls()
is equivalent to the ls
command. It returns filenames as a
named fs_path
character vector. The names are equivalent to the values,
which is useful for passing onto functions like purrr::map_dfr()
.
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,
recurse = FALSE,
type = "any",
glob = NULL,
regexp = NULL,
invert = FALSE,
fail = TRUE,
...,
recursive
)
dir_map(
path = ".",
fun,
all = FALSE,
recurse = FALSE,
type = "any",
fail = TRUE
)
dir_walk(
path = ".",
fun,
all = FALSE,
recurse = FALSE,
type = "any",
fail = TRUE
)
dir_info(
path = ".",
all = FALSE,
recurse = FALSE,
type = "any",
regexp = NULL,
glob = NULL,
fail = TRUE,
...
)
path |
A character vector of one or more paths. |
all |
If |
recurse |
If |
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. |
recursive |
(Deprecated) If |
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", recurse = TRUE, glob = "*.R")
# If you need the full paths input an absolute path
dir_ls(path_abs("base"))
dir_map("base", identity)
dir_walk("base", str)
dir_info("base")
# Cleanup
link_delete("base")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.