Skip to content Skip to sidebar Skip to footer

Empty Folders Are Not Adding To Zip File Android

I am doing an Android project. I need to zip a complete folder structure of SD card. code is able to zip the folder if any files exists inside the folder, else skips that folder. M

Solution 1:

You basically never create a zipentry for your directories.

In the if (f.isDirectory()) {} section, add this:

zos.putNextEntry(newZipEntry(filePath));

You can also put it at the beginning of the method instead, to include the root dir as well.

Post a Comment for "Empty Folders Are Not Adding To Zip File Android"