list.files {base} | R Documentation |
This function produces a list containing the names of files
in the named directory. dir
is an alias.
list.files(path = ".", pattern=NULL, all.files=FALSE, full.names=FALSE)
dir(path = ".", pattern=NULL, all.files=FALSE, full.names=FALSE)
path |
a character vector of full path names. |
pattern |
an optional regular expression. Only file names which match the regular expression will be returned. |
all.files |
a logical value. If |
full.names |
a logical value. If |
A character vector containing the names of the files in the
specified directories, or ""
if there were no files. If a
path does not exist or is not a directory or is unreadable it
is skipped, with a warning.
The files are sorted in alphabetical order, on the full path
if full.names = TRUE
.
File naming conventions are very platform dependent.
Ross Ihaka
file.info
, file.access
and files
for many more file handling functions.
list.files(R.home())
## Only files starting with a-l or r (*including* uppercase):
dir("../..", pattern = "^[a-lr]",full.names=TRUE)