- import net.lingala.zip4j.ZipFile;
- import net.lingala.zip4j.exception.ZipException;
- import java.io.IOException;
- public class SampleClass{
- public static void main(String[] args)
- throws ZipException,
- IOException{
- ZipFile zip = null;
- try{
- zip = new ZipFile
- ("myzip.zip");
- //remove a file
- zip.removeFile("img.jpg");
- //remove a directory (since v2.5.0 of Zip4j)
- zip.removeFile("folder/folderA/");
- }
- finally{
- if(zip != null)
- zip.close();
- }
- System.out.println("main thread end.");
- }
- }