- import net.lingala.zip4j.ZipFile;
- import net.lingala.zip4j.exception.ZipException;
- import net.lingala.zip4j.model.ZipParameters;
- import java.io.File;
- import java.io.IOException;
-
- public class SampleClass{
-
- public static void main(String[] args)
- throws ZipException,
- IOException{
- ZipFile zip = null;
-
- try{
- ZipParameters zp = new ZipParameters();
- zp.setExcludeFileFilter
- (exclude ->; {
- if(exclude.toString().endsWith(".JPEG"))
- return true;
- else return false;
- });
- zip = new ZipFile("myzip.zip");
- zip.addFolder(new File("folder"), zp);
- }
- finally{
- if(zip != null)
- zip.close();
- }
-
- System.out.println("Done!");
- }
- }