Created
December 22, 2021 15:21
-
-
Save davidohana/0d6f27fba7df32f6592fc8a4b3336af1 to your computer and use it in GitHub Desktop.
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
fun getJarVersions(jarFolder: String): String { | |
val jarFiles = File(jarFolder) | |
.listFiles { _, name -> name.toLowerCase().endsWith(".jar") } | |
?: emptyArray() | |
val text = jarFiles.map { "\t" + it }.sorted().joinToString("\n") | |
return "${jarFiles.size} JAR files below ${jarFolder}: \n${text}" | |
} | |
object App { | |
@JvmStatic | |
fun main(args: Array<String>) { | |
println(getJarVersions("lib")) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment