Created
December 1, 2014 07:22
-
-
Save saw303/b7c52934f0b035bd435b to your computer and use it in GitHub Desktop.
This script deletes all folders in the local Gradle cache that version is lower than a specific one
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def baseName = '3.05.BUILD-' | |
def version = '161' | |
def composedName = "${baseName}${version}" | |
def rootDir = new File('/home/saw/.gradle/caches/artifacts-24/filestore/com.adcubum.syrius') | |
assert rootDir.exists() && rootDir.canWrite() | |
def killList = [] | |
rootDir.eachDirRecurse { dir -> | |
if (dir.name.startsWith(baseName) && dir.name.split('-')[1].toInteger() < version.toInteger()) { | |
println "KILL THAT PIECE ${dir.absolutePath}" | |
killList << dir | |
} | |
else { | |
//println "SKIP ${dir.name}" | |
} | |
} | |
killList.each { dir -> dir.deleteDir() } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment