list_files: List files in a directory

View source: R/list_files.R

list_filesR Documentation

List files in a directory

Description

A wrapper around list.files() that gives the possibility to name each file directly.

Usage

list_files(
  path = ".",
  target = NULL,
  names,
  full.names = TRUE,
  ...,
  err_on_empty = TRUE
)

Arguments

path

A character vector of full path names.

target

An optional regular expression to return only file names that match the regular expression.

names

A vector of names to assign to each file, a function, formula or regular expression to extract names from file names.

full.names

Should the full path be returned?

...

Other arguments passed on to list.files().

err_on_empty

If TRUE, the function throws an error if no files are matched.

Value

A character vector of class collection.


arnaudgallou/toolkit documentation built on Nov. 25, 2022, 5:42 p.m.