listFiles | R Documentation |
This function is a wrapper around list.files
from base R, providing additional options
such as automatic conversion from glob to regex patterns, this function supports direct use of standard
directory patterns like "*" and "?" for matching files. Full names is enabled automatically when recursive search is activated.
listFiles(
path = ".",
pattern = "*",
fullnames = FALSE,
recursive = FALSE,
regex = FALSE
)
path |
Character. The path where to look for the files. Defaults to the current directory. |
pattern |
Character. The pattern to match the files against. Supports both glob and regex patterns. Defaults to "*". |
fullnames |
Logical. Whether to return full names including the path. Defaults to FALSE. |
recursive |
Logical. Whether to list files recursively. Defaults to FALSE. |
regex |
Logical. Whether the provided pattern is a regex pattern. Defaults to FALSE. |
Character vector. A vector of file names that match the criteria.
## Not run:
listFiles(path = "path/to/directory", pattern = "*.txt")
listFiles(path = "path/to/directory", pattern = "file[0-9]\\.txt", regex = TRUE)
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.