For those times when you only want to know the local directories available, use this instead of struggling through myriad arguments to dir
. All arguments are the same as for plain old "dir" and are passed to dir
.
dirdir(path = ".", pattern = NULL, all.files = FALSE, full.names = FALSE,
recursive = FALSE, ignore.case = FALSE, include.dirs = FALSE, no.. = FALSE)
Note: this is directly quoted from the man page for dir
.
A character vector containing the names of the files in the specified directories (empty if there were no files). If a path does not exist or is not a directory or is unreadable it is skipped.
The files are sorted in alphabetical order, on the full path if full.names = TRUE.
a character vector of full path names; the default corresponds to the working directory, getwd(). Tilde expansion (see path.expand) is performed. Missing values will be ignored. Elements with a marked encoding will be converted to the native encoding (and if that fails, considered non-existent).
an optional regular expression. Only file names which match the regular expression will be returned.
a logical value. If FALSE, only the names of visible files are returned (following Unix-style visibility, that is files whose name does not start with a dot). If TRUE, all file names will be returned.
a logical value. If TRUE, the directory path is prepended to the file names to give a relative file path. If FALSE, the file names (rather than paths) are returned.
logical. Should the listing recurse into directories?
logical. Should pattern-matching be case-insensitive?
logical. Should subdirectory names be included in recursive listings? (They always are in non-recursive ones).
logical. Should both "." and ".." be excluded also from non-recursive listings?
Carl Witthoft, carl@witthoft.com