Skip to contents

Lists files inside a given directory.

Usage

list_files_dir(path, max_files = NULL, type = "file")

Arguments

path

(character(n))
Character vector of one or more paths.

max_files

(integer(1))
Max files returned.

type

(character(n))
File type(s) to return (e.g. any, file, directory). See fs::dir_info. Symlinks are followed and classified by their target, so a symlink to a file counts as a file (with the target's size and modification time); broken symlinks are dropped.

Value

A tibble with file basename, size, last modification timestamp and full path.

Examples

d <- system.file("R", package = "nemo")
x <- list_files_dir(d)
# symlinked files are included
d2 <- fs::dir_create(tempfile())
f <- fs::file_create(file.path(d2, "real.tsv"))
fs::link_create(f, file.path(d2, "link.tsv"))
x2 <- list_files_dir(d2)