R/clear-knitr-cache.R

Defines functions clear.knitr.cache

Documented in clear.knitr.cache

##' Delete everything in the project "cache" directory
##' Removed all files in "../cache" by default.
##' @title Delete knitr cache
##' @param cachedir The name of the directory in the present project
##(via dirname(getwd())) where files are to be deleted.
##' @return Deletes all files in the specified directory
##' @author Kieran Healy
##' @export
clear.knitr.cache <- function(cachedir="cache") {
  orig.dir <- getwd()
  parent.dir <- dirname(getwd())
  target.dir <- paste(parent.dir, "/", cachedir, sep="")
  full.cmd <- paste("rm -f ",target.dir,"/*.*", sep="")
  system(full.cmd)
  setwd(orig.dir)
}
GarrettMooney/moonmisc documentation built on Oct. 19, 2019, 7:51 p.m.