Closed baboyma closed 1 year ago
This function use ctime to pick the latest file matching the search. ctime is altered for backed up files leading to ctime > mtime. Should we switch to max(mtime) instead?
ctime
max(mtime)
Sample code to reproduce this:
list.files(path = glamr::si_path("path_vector"), pattern = "VcPepfarPolygons.shp$", full.names = TRUE, recursive = T) %>% file.info() %>% tibble::rownames_to_column(var = "filepath") %>% dplyr::filter(ctime == max(ctime)) %>% dplyr::pull(filepath) list.files(path = glamr::si_path("path_vector"), pattern = "VcPepfarPolygons.shp$", full.names = TRUE, recursive = T) %>% file.info() %>% tibble::rownames_to_column(var = "filepath") %>% dplyr::filter(ctime == max(mtime)) %>% dplyr::pull(filepath)
In updating, needed to update both sides of the equation
https://github.com/USAID-OHA-SI/glamr/blob/32b2385257a5d848c75d5da67f0868e0275dc439/R/return_latest.R#L35
Should be dplyr::filter(mtime == max(mtime)) %>%
dplyr::filter(mtime == max(mtime)) %>%
This function use
ctime
to pick the latest file matching the search.ctime
is altered for backed up files leading to ctime > mtime. Should we switch tomax(mtime)
instead?Sample code to reproduce this: