Returns names of files and directories located in a given directory. It's similar to list.files() only with better defaults and behaviors.

list_paths(path = ".", full = TRUE, all = FALSE, recursive = FALSE,
  pattern = NULL, ignore.case = FALSE, invert = FALSE)

Arguments

path

Directory from which to locate paths (files and directories)– defaults to current working directory.

full

Logical indicating whether to return full paths. Defaults to TRUE.

all

Logical indicating whether to return all (include dot names) paths. Defaults to FALSE.

recursive

Logical indicating whether to recursively list paths.

pattern

Regular expression pattern on which to filter (return) matching results. Defaults to NULL, meaning all paths will be returned.

ignore.case

Logical indicating whether to ignore case if pattern is supplied–defaults to FALSE.

invert

Logical indicating whether to invert (return those that DO NOT match) pattern matching results–defaults to FALSE.

Value

A character vector of paths.

See also

Other list_paths: list_dirs, list_files

Examples

## list paths in working directory list_paths()
#> [1] "/Users/mwk/R/fml/docs/reference/dir_create.html" #> [2] "/Users/mwk/R/fml/docs/reference/dir_exists.html" #> [3] "/Users/mwk/R/fml/docs/reference/dir_name.html" #> [4] "/Users/mwk/R/fml/docs/reference/dir_tmp.html" #> [5] "/Users/mwk/R/fml/docs/reference/dot-home.html" #> [6] "/Users/mwk/R/fml/docs/reference/dot-Renviron.html" #> [7] "/Users/mwk/R/fml/docs/reference/figures" #> [8] "/Users/mwk/R/fml/docs/reference/file_create.html" #> [9] "/Users/mwk/R/fml/docs/reference/file_exists.html" #> [10] "/Users/mwk/R/fml/docs/reference/file_info.html" #> [11] "/Users/mwk/R/fml/docs/reference/file_name.html" #> [12] "/Users/mwk/R/fml/docs/reference/file_path.html" #> [13] "/Users/mwk/R/fml/docs/reference/file_symlink.html" #> [14] "/Users/mwk/R/fml/docs/reference/file_tmp.html" #> [15] "/Users/mwk/R/fml/docs/reference/find_file.html" #> [16] "/Users/mwk/R/fml/docs/reference/fml-package.html" #> [17] "/Users/mwk/R/fml/docs/reference/fp.html" #> [18] "/Users/mwk/R/fml/docs/reference/here.html" #> [19] "/Users/mwk/R/fml/docs/reference/index.html" #> [20] "/Users/mwk/R/fml/docs/reference/list_dirs.html" #> [21] "/Users/mwk/R/fml/docs/reference/list_files.html" #> [22] "/Users/mwk/R/fml/docs/reference/list_paths.html" #> [23] "/Users/mwk/R/fml/docs/reference/match_files.html" #> [24] "/Users/mwk/R/fml/docs/reference/package_file.html" #> [25] "/Users/mwk/R/fml/docs/reference/path_expand.html" #> [26] "/Users/mwk/R/fml/docs/reference/read_access.html" #> [27] "/Users/mwk/R/fml/docs/reference/search_file.html" #> [28] "/Users/mwk/R/fml/docs/reference/write_access.html"