I'm trying to add a folder to the archive like this (according to the documentation):

//file - пустая папка, parametrs - обычный параметры, ничего важного zipStream.putNextEntry(file, parameters); if (file.isDirectory()) { //В документации написано, что, если файл является папкой, //нужно закрыть элемент zipStream.closeEntry(); } 

But, as a result, the program puts a file with the folder name into my archive: /.


How to add a folder to the archive?

  • one
    If without streams, then, like, just github.com/dmp/zip4j/blob/master/src/net/lingala/zip4j/examples/… - YuriySPb
  • @ YuriySPb, I know that without streams just ... :) - user189127
  • one
    @YuriySPb, now I will rewrite without streams. I can’t think of anything ... - user189127
  • one
    @ bukashka101, do not forget to write in response) - Yuriy SPb
  • one
    No, no need to delete. Let it be better without a response stream than there will be no answer at all) - YuriySPb

1 answer 1

Still, not finding the answer, I came to the conclusion that it is better to use archiving without streams.

Initially, I wanted to get a completely accurate archive creation progress (summarized the sizes of all files, well, then by the formula), but, alas, I did not find a way to deal with folders. I managed to digest both folders and files, and even subfolders in subfolders using the cunning maneuver method, but without exact creation progress (now there are two bands: the percentage of archived folders and the percentage of archiving the current file).