list_files {seekr} | R Documentation |
List Files in Directory
Description
Lists all files from a given directory with support for recursive search and inclusion of hidden files.
The function throws a specific error when no files are found, based on the combination of
recurse
and all
parameters. Returned file paths are made unique and are assumed to be
normalized using forward slashes (/
).
Usage
list_files(path, recurse, all)
Arguments
path |
A character vector of one or more paths. |
recurse |
If |
all |
If |
Value
A character vector of unique file paths. If no files are found, the function aborts with a
message suggesting how to adjust search parameters (recurse
and all
), and includes a
class-specific error identifier depending on the search mode:
-
"error_list_files_TT"
forrecurse = TRUE
,all = TRUE
-
"error_list_files_TF"
forrecurse = TRUE
,all = FALSE
-
"error_list_files_FT"
forrecurse = FALSE
,all = TRUE
-
"error_list_files_FF"
forrecurse = FALSE
,all = FALSE
Examples
## Not run:
list_files("myfolder", recurse = TRUE, all = FALSE)
## End(Not run)