There doesn't seem to be a way to list ZipEntryin a specific directory.
You need to go through ZipFile.entries()and filter out the ones you want based on ZipEntry.getName()and look, not String.startsWith(String prefix).
String specificPath = "some/path/in/zip/";
ZipFile zipFile = new ZipFile(file);
Enumeration<? extends ZipEntry> entries = zipFile.entries();
while (entries.hasMoreElements()) {
ZipEntry ze = entries.nextElement();
if (ze.getName().startsWith(specificPath)) {
System.out.println(ze);
}
}
source
share