R/cleanup.R

Defines functions cleanup

cleanup <- function(sse.remove.folder=TRUE){
  
  print('- Cleaning up..')
  
  # remove old files before new run
  unlink(dir(pattern="runA")[!dir(pattern="runA") %in% dir(pattern="runA")[grep("mod", dir(pattern="runA"))]])
  unlink(dir(pattern="runB")[!dir(pattern="runB") %in% dir(pattern="runB")[grep("mod", dir(pattern="runB"))]])
  
  files<-c("xml","_L","_R", "INTER", "LINK", "OUTPUT", "nul",
           "nmprd4p.mod", "nonmem",
           "nmfe72", "set", "newline", "gfortran", "prsizes",
           "trash", "compile", "matlab",
           "garbage.out", paste(1:30, ".m", sep=""))
  
  for(f in files){    
    unlink(dir(pattern=f))
  }
  
  # remove PsN folders
  if(sse.remove.folder){
    if( length(dir(pattern="modelfit"))>0){
      system('rm -r modelfit*')
    }
  }  
}
andrewhooker/MBAOD documentation built on June 3, 2017, 5:12 p.m.