R/move_ospsreports_files.R

Defines functions move_ospsreports_files

Documented in move_ospsreports_files

#' @title Move the documents files
#' @description Copy the files of a packaged \code{drake} workflow into a supplied directory.
#' @param to Character scalar, file path, where to write the folders containing the workflow's files.
#' @return `NULL`
#' @importFrom purrr map
#' @importFrom purrr walk2
#' @examples
#'
#' @export
move_ospsreports_files <- function(to = getwd()){
  
  # Check that the directories match the names of the overwrite_dirs
  directories<-list.files("documents", recursive = TRUE)
  
  purrr::walk(paste0("documents/", unique(gsub("/.*","\\1",directories))), ~file.copy(.x, 
                                                                                      to = to, recursive = TRUE))
  
  unlink("documents", recursive = TRUE)
  
  invisible()
  
}
JGWojtyniak/ospsreports documentation built on Nov. 14, 2019, 12:11 p.m.