list.files package:base R Documentation _L_i_s_t _t_h_e _F_i_l_e_s _i_n _a _D_i_r_e_c_t_o_r_y/_F_o_l_d_e_r _D_e_s_c_r_i_p_t_i_o_n: These functions produce a character vector of the names of files in the named directory. _U_s_a_g_e: list.files(path = ".", pattern = NULL, all.files = FALSE, full.names = FALSE, recursive = FALSE, ignore.case = FALSE) dir(path = ".", pattern = NULL, all.files = FALSE, full.names = FALSE, recursive = FALSE, ignore.case = FALSE) _A_r_g_u_m_e_n_t_s: path: a character vector of full path names; the default corresponds to the working directory 'getwd()'. Missing values will be ignored. pattern: an optional regular expression. Only file names which match the regular expression will be returned. all.files: a logical value. If 'FALSE', only the names of visible files are returned. If 'TRUE', all file names will be returned. full.names: a logical value. If 'TRUE', the directory path is prepended to the file names. If 'FALSE', only the file names are returned. recursive: logical. Should the listing recurse into directories? ignore.case: logical. Should pattern-matching be case-insensitive? _V_a_l_u_e: 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'. Directories are included only if 'recursive = FALSE'. _N_o_t_e: File naming conventions are platform dependent. 'recursive = TRUE' is not supported on all platforms and may be ignored (with a warning). _A_u_t_h_o_r(_s): Ross Ihaka, Brian Ripley _S_e_e _A_l_s_o: 'file.info', 'file.access' and 'files' for many more file handling functions and 'file.choose' for interactive selection. 'glob2rx' to convert wildcards (as used by system file commands and shells) to regular expressions. 'Sys.glob' for wildcard expansion on file paths. _E_x_a_m_p_l_e_s: list.files(R.home()) ## Only files starting with a-l or r ## Note that a-l is locale-dependent, but using case-insensitive ## matching makes it unambiguous in English locales dir("../..", pattern = "^[a-lr]",full.names=TRUE, ignore.case = TRUE)