0

I'm creating a zipped archive with zip4j using the following method to add single files to the archive:

  zipParameters = new ZipParameters();
  zipParameters.setCompressionMethod(Zip4jConstants.COMP_DEFLATE);
  zipParameters.setCompressionLevel(Zip4jConstants.DEFLATE_LEVEL_ULTRA);
  zipFile = new ZipFile(fullQualifiedZipFile);
  ...
  zipFile.addFile(new File(fullQualilfiedPath), zipParameters);

Doing so, the resulting archive doesn't contain the folder structure. Any idea how to resolve this? Thanks in advance for any hint!

Kind regards,

Michael

1 Answers1

0

Just if somebody is interested, I've found the solution. Before adding a file to the archive, method setRootFolderInZip must be called:

        zipParameters.setRootFolderInZip(folder);

This will lead to the desired result, that the folder structure will be preserved. You may want to adjust the folder. At least the root part should be removed.

Michael