| dir_or_file {chinese.misc} | R Documentation |
The input can be one or more directories, one or more files, or the mixture of the two.
It will return the full paths of all files in a recursive way,
and sort them in increasing order. When files are put in
different areas of your disk, you may need this function to collect them.
It is essentially a wrapper of list.files.
dir_or_file(..., special = "")
... |
names of directories and files; if the input is not vector, the function will try to coerce it. Relative paths and paths starting with "~/" are also accepted. In Windows, both "/" and double inversed slashes inside filenames are accepted. |
special |
a length 1 character or regular expression. Only filenames that have this pattern will be collected. Default value is "" (character with size 0), and is to collect everything. |
Failure may occur when obtaining absolute paths, please see normalizePath
for possible reasons.
a character vector of full filenames with increasing order, and every name is unique. If no filename is collected, an error will be raised.
x1 <- find.package("base")
x2 <- find.package("utils")
all_file <- dir_or_file(x1, x2, special = "rds$")