微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

Groovy批处理命令

文件中被注释的代码一个获取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

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。

相关推荐