R/rm_files.R

Defines functions rm_files

Documented in rm_files

#' Create a new file
#'
#' Just a wrapper for file.create or dir.create
#'
#' @export
#' @param x a file (or vector of them) to delete
rm_files <- function(x) {
  if (sum(stringr::str_detect(x, "\\.")) > 0) {
    file.remove(x)
  } else {
    unlink(x,recursive = TRUE)
  }
  
  glue::glue_col("
                   {red Deleted:}
                   {gi {  glue::glue_collapse(x,sep = ', ')}}
                   ")
  
}
bweiher/bwmisc documentation built on Aug. 9, 2019, 4:31 p.m.