0

I want to get the top level folder of a zip file using ZipInputStream.

Say, I have a zip file test.zip that contains the following entries:

topFolder/sub/sample.jpg

When I use ZipInputStream, the first entry that it gets is topFolder/sub/

Is there a way that we can get the top folder topFolder?

while ((entry = zipInputStream.getNextEntry()) != null) {
  
}
jetpack
  • 169
  • 1
  • 9
  • Zip files don't store directories. They only store files with a path. So directories would need to be derived from all the file paths. – Codo Nov 10 '22 at 12:59

0 Answers0