dir_create()1. Create a new observation folder with today’s date
Let’s see what folders currently exist in our “file-system” folder
base::basename() removes all of
the path up to and including the last path separator so we can simply
view the folder names herebase::basename(fs::dir_ls(here::here("file-system")))
[1] "obs_2022-03-15"
Let’s make another folder called “obs_2022-03-16” (which is today’s date at the time of creating this file).
lubridate::today() function to grab
today’s date in the form of YYYY-MM-DD and I use
base::paste0 to paste a prefix, “obs_” to today’s
date.fs::dir_create(here::here("file-system", base::paste0("obs_",lubridate::today())))
Now let’s see what folders currently exist in our “file-system” folder
base::basename(fs::dir_ls(here::here("file-system")))
[1] "obs_2022-03-15" "obs_2022-03-16"
Return to File System