This function lets the user list all files on a given directory. It also lets filter files which contains a string.
Usage
listfiles(folder = getwd(), recursive = TRUE, regex = NA, images = FALSE)See also
Other Tools:
autoline(),
bind_files(),
bring_api(),
chr2num(),
db_download(),
db_upload(),
dont_sleep(),
export_plot(),
export_results(),
files_functions(),
font_exists(),
formatColoured(),
formatHTML(),
glued(),
grepm(),
h2o_selectmodel(),
haveInternet(),
image_metadata(),
importxlsx(),
ip_data(),
json2vector(),
list_cats(),
mail_send(),
markdown2df(),
move_files(),
msplit(),
myip(),
quiet(),
read.file(),
statusbar(),
tic(),
try_require(),
updateLares(),
warnifnot(),
what_size()
Examples
# All files in current directory (without recursive files)
df <- listfiles(recursive = TRUE)
head(df, 3)
#> filename size isdir mode mtime ctime
#> 1 ROC.html 16 FALSE 644 2025-11-05 18:50:57 2025-11-05 18:50:57
#> 2 autoline.html 20 FALSE 644 2025-11-05 18:50:57 2025-11-05 18:50:57
#> 3 balance_data.html 9 FALSE 644 2025-11-05 18:50:57 2025-11-05 18:50:57
#> atime uid gid uname grname
#> 1 2025-11-05 18:50:57 1001 1001 runner runner
#> 2 2025-11-05 18:50:57 1001 1001 runner runner
#> 3 2025-11-05 18:50:57 1001 1001 runner runner
# All files in current directory (with recursive files)
df <- listfiles(recursive = TRUE)
tail(df, 3)
#> filename size isdir mode mtime ctime
#> 128 lasso_vars.html 11 FALSE 644 2025-11-05 18:51:38 2025-11-05 18:51:38
#> 129 left_right.html 7 FALSE 644 2025-11-05 18:51:38 2025-11-05 18:51:38
#> 130 list_cats.html 11 FALSE 644 2025-11-05 18:51:38 2025-11-05 18:51:38
#> atime uid gid uname grname
#> 128 2025-11-05 18:51:38 1001 1001 runner runner
#> 129 2025-11-05 18:51:38 1001 1001 runner runner
#> 130 2025-11-05 18:51:38 1001 1001 runner runner
# Check R files using regex
df <- listfiles(regex = "\\.R$")
