directories in a zip file when using java.util.zip.ZipOutputStream

后端 未结 6 1616
北荒
北荒 2020-12-04 13:40

Lets say I have a file t.txt, a directory t and another file t/t2.txt. If I use the linux zip utility \"zip -r t.zip t.txt t\", I get a zip file with the following entries i

6条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2020-12-04 13:52

    You can add "/" at the end of folder name. Just use the following command:

    zip.putNextEntry(new ZipEntry("xml/"));
    

提交回复
热议问题