in teamcity-rest-client-impl/src/main/kotlin/org/jetbrains/teamcity/rest/coroutines/implementation.kt [2184:2196]
override suspend fun downloadArtifacts(pattern: String, outputDir: File) {
val list = getArtifacts(recursive = true)
val regexp = convertToJavaRegexp(pattern)
val matched = list.filter { regexp.matches(it.fullName) }
if (matched.isEmpty()) {
val available = list.joinToString(",") { it.fullName }
throw TeamCityQueryException("No artifacts matching $pattern are found in build ${getBuildNumber()}. Available artifacts: $available.")
}
outputDir.mkdirs()
matched.forEach {
it.download(File(outputDir, it.name))
}
}