文件中被注释的代码一个是 获取MD5,另一个是过滤出包名 批量删除应用
test.groovy
class test {
public static void main(String[] args) {
def file = new File("C:\\Users\\Administrator\\Desktop\\screen\\test")
file.listFiles().each{ subFile ->
// println "certutil -hashfile ${subFile.name} MD5".execute().text
if (subFile.name.endsWith("apk")) {
println "adb install ${subFile.name}".execute().text
// def segment = subFile.name.split("-")
// def packageName = segment[segment.length-2]
// "adb uninstall ${packageName} ".execute()
}
}
}
}
运行命令:
groovy test.groovy
C:\Users\Administrator\Desktop\screen\test下文件:
3D-Tech-locker.theme.l400000057-release.apk
Bear-locker.theme.l400000056-release.apk
City-Neon-locker.theme.l400000052-release.apk
Crocodile-locker.theme.l400000044-release.apk
Dusk-locker.theme.l400000045-release.apk
Falling-Flower-locker.theme.l400000051-release.apk
Fresh-Fruit-locker.theme.l400000050-release.apk
'Living Hummingbird-locker.theme.l400000055-release.apk'
Moto-Surfing-locker.theme.l400000046-release.apk
Parrots-locker.theme.l400000039-release.apk
Pink-Valentine-locker.theme.l400000058-release.apk
Rose-Valentine-locker.theme.l400000059-release.apk
Shore-locker.theme.l400000047-release.apk
test.groovy
Valentine-Rose-locker.theme.l400000060-release.apk
Winter-Glacier-locker.theme.l400000053-release.apk