Now deep clean is realy deep :)

This commit is contained in:
hollorol 2017-07-17 18:24:28 +02:00
parent 9913ff6bb9
commit 450aefe9d2
2 changed files with 39 additions and 31 deletions

View File

@ -1,5 +1,5 @@
cleanupMuso <- function(location=NULL, simplicity=TRUE,deep=FALSE){ cleanupMuso <- function(location=NULL, simplicity=TRUE,deep=FALSE){
areThereAnyFolders <- FALSE
whereAmI <- getwd() whereAmI <- getwd()
if(!is.null(location)){ if(!is.null(location)){
setwd(location) setwd(location)
@ -10,40 +10,48 @@ cleanupMuso <- function(location=NULL, simplicity=TRUE,deep=FALSE){
setwd("LOG") setwd("LOG")
file.remove( file.remove(
grep("(out$)|(endpoint$)|(log$)", grep("(out$)|(endpoint$)|(log$)",
list.files(), value = T) list.files(), value = T))
)} areThereAnyFolders <- TRUE
}
if(dir.exists("../ERROR")){ if(dir.exists("../ERROR")){
setwd("../ERROR") setwd("../ERROR")
file.remove( file.remove(
grep("(out$)|(endpoint$)|(log$)", grep("(out$)|(endpoint$)|(log$)",
list.files(), value = T) list.files(), value = T))
)} areThereAnyFolders <- TRUE
}
if(dir.exists("../EPCS")){ if(dir.exists("../EPCS")){
setwd("../EPCS") setwd("../EPCS")
file.remove( file.remove(
grep("(out$)|(endpoint$)|(log$)|(epc$)", grep("(out$)|(endpoint$)|(log$)|(epc$)",
list.files(), value = T) list.files(), value = T))
)} areThereAnyFolder <- TRUE
}
if(dir.exists("../WRONGEPC")){ if(dir.exists("../WRONGEPC")){
setwd("../WRONGEPC") setwd("../WRONGEPC")
file.remove( file.remove(
grep("(out$)|(endpoint$)|(log$)|(epc$)", grep("(out$)|(endpoint$)|(log$)|(epc$)",
list.files(), value = T) list.files(), value = T))
)} areThereAnyFolders <- TRUE
}
if(areThereAnyFolders){
setwd("..") setwd("..")
file.remove( file.remove(
grep("(out$)|(endpoint$)|(log$)", grep("(out$)|(endpoint$)|(log$)",
list.files(), value = T) list.files(), value = T))
) } else {
file.remove(
grep("(out$)|(endpoint$)|(log$)",
list.files(), value = T))}
} }
if(!simplicity){ if(!simplicity){
file.remove( file.remove(
grep("(out$)|(endpoint$)|(log$)", grep("(out$)|(endpoint$)|(log$)",

View File

@ -10,7 +10,7 @@ rungetMuso <- function(settings, timee="d", debugging=FALSE, logfilename=NULL, k
############################################################# #############################################################
############################spinup run############################ ############################spinup run############################
########################################################## ##########################################################
##Copy the variables from settings ##Copy the variables from settings
inputloc <- settings$inputloc inputloc <- settings$inputloc
@ -69,9 +69,9 @@ rungetMuso <- function(settings, timee="d", debugging=FALSE, logfilename=NULL, k
if(!spincrash){##If spinup did not crashed, run the normal run. if(!spincrash){##If spinup did not crashed, run the normal run.
##################################################################### #####################################################################
###########################normal run######################### ###########################normal run#########################
################################################################# #################################################################
##for the sake of safe we set the location again ##for the sake of safe we set the location again
setwd(inputloc) setwd(inputloc)
@ -120,7 +120,7 @@ rungetMuso <- function(settings, timee="d", debugging=FALSE, logfilename=NULL, k
} }
} }
##if errorsign is 1 there is error, if it is 0 everything ok ##if errorsign is 1 there is error, if it is 0 everything ok
if(length(perror)>sum(perror)){ if(length(perror)>sum(perror)){
errorsign <- 1 errorsign <- 1
} else { } else {