zip4j icon indicating copy to clipboard operation
zip4j copied to clipboard

there is some problems use fileHead to extractFile

Open lzxshare opened this issue 3 years ago • 2 comments
trafficstars

for example, i add some files to zipFile, they are has same file name but from different path.

A/B/word.text A/B/C/word.text F/G/word.text

when i use this way to extract file: FileHeader fileHeader = zipFile.getFileHeader("word.text"); zipFile.extractFile(fileHeader, parentFile.getAbsolutePath(), mergeName);

it extract file is not i expected, so how can i get correct file when use FileHeader ?

lzxshare avatar Jul 25 '22 06:07 lzxshare

You have to use the complete path in getFileHeader() method. In your case, for example, if you want to extract A/B/C/word.text, you have to use zipFile.getFileHeader("A/B/C/word.text")

srikanth-lingala avatar Jul 25 '22 08:07 srikanth-lingala

many thanks. sir,i try your suggestions,but it got FileHeader returns null. i also debug the source code ,the zip FileHeader info only show the file name, not contains full file path. i use the library version is 2.8.0. should i use the new library version?here is debug info for FileHeads
image

lzxshare avatar Jul 25 '22 09:07 lzxshare

Question answered here

srikanth-lingala avatar Sep 12 '22 15:09 srikanth-lingala