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$)",