dir2: List files and directories recursively to a certain depth

Description Usage Arguments Details Value See Also Examples

Description

List files and directories recursively to a certain depth

Usage

1
2
3
dir2(path = ".", pattern = NULL, all.files = FALSE, full.names = TRUE,
  recursive = FALSE, ignore.case = FALSE, include.dirs = FALSE,
  absolute = FALSE)

Arguments

path

a character vector of paths.

pattern

(optional) an optional regular expression. Full path names (including path and file names) that match the regular expression will be returned.

all.files

If FALSE, non-visible files (prefixed with a .) are not returned. If TRUE, all files are returned.

full.names

If TRUE or recursive = TRUE (or a positive number), full path names are returned, otherwise only the file names.

recursive

If FALSE or 0, content of sub-directories is not included. if TRUE or +Inf, content of all sub-directories are recursively included. If a positive number depth, then sub-directories to that depth is recursively included.

ignore.case

If TRUE, pattern matching is case-insensitive, othewise not.

include.dirs

If TRUE, also directories are returned, otherwise not.

absolute

If TRUE or length(path) > 1, absolute path names are returned and used in the file pattern matching.

Details

Files ‘.’ and ‘..’ (the current and parent directories) are never returned.

Value

Character vector of identified files and directories.

See Also

base::dir()

Examples

1
2
3
4
5
6
7
8
9
path <- system.file(package = "dirdf")
files <- dir2(path, include.dirs = TRUE)
print(files)

files <- dir2(path, recursive = 1L)
print(files)

files <- dir2(path, recursive = TRUE)
print(files)

ropenscilabs/dirdf documentation built on May 27, 2019, 8:32 p.m.