mahmoud hooda
mahmoud hooda

Reputation: 1

Create empty zip file using Zip4j library

I want to know how to create empty zip file using Zip4j library.

Shouldn't this line of code be enough to create an empty zip file? When I tried it, it doesn't work.

ZipFile zipFile1 = new ZipFile(zipFilePath);

My question is for this lib : https://github.com/srikanth-lingala/zip4j

Edit

An answer told me to create ZipFile and add file in it then remove that file. I just want to create ZipFile directly without any complications, just function get path like "/storage/emulated/0/ZipPro/zipPro.zip" and create this zip file "zipPro.zip".

Upvotes: -1

Views: 426

Answers (1)

FARS
FARS

Reputation: 457

Try this:

            File file = new File("path/to/folder/FOLDER_NAME");
            if(!file.exists())
                file.mkdir();
            ZipFile zipFile = new ZipFile(file);
            zipFile.extractAll(file.getPath());

Upvotes: 0

Related Questions