in src/main/java/co/elastic/support/util/ArchiveUtils.java [40:69]
private static void archiveResultsZip(
String archiveFilename,
ZipArchiveOutputStream zipFileStream,
File file,
String path,
boolean append) {
String relPath = (path == null ? "" : path + "/") + file.getName();
try {
if (append) {
relPath += "-" + archiveFilename;
}
if (file.isFile()) {
zipFileStream.putArchiveEntry(new ZipArchiveEntry(file, relPath));
try (BufferedInputStream bis = new BufferedInputStream(new FileInputStream(file))) {
IOUtils.copy(bis, zipFileStream);
} finally {
zipFileStream.closeArchiveEntry();
}
} else if (file.isDirectory()) {
for (File childFile : file.listFiles()) {
archiveResultsZip(archiveFilename, zipFileStream, childFile, relPath, false);
}
}
} catch (IOException e) {
logger.error(Constants.CONSOLE, "Archive Error", e);
}
}