title: How to get .png files alone from one folder
body: <p>Actually, i'm trying to zip all the files from one folder &amp; .png files from another folder. I can able to get all the files from one folder. But i can't able to get the .png files from another folder in java. Is there any way ?</p>
  
  <p>Code:</p>
  
  <pre><code>public class Zip {
      public static void zip(String filepath,String reportFileName){
          try {
              File inFolder=new File(filepath);
              File inFolder1=new File("../Agent_Portal_Auto_Testing/ReportCharts");
              File outFolder=new File(reportFileName);
              ZipOutputStream out = new ZipOutputStream(new BufferedOutputStream(new FileOutputStream(outFolder)));
              BufferedInputStream in = null;
              byte[] data  = new byte[1000];
              String files[] = inFolder.list();
              String files1[]=inFolder1.list();
              for (int i=0; i&lt;files.length; i++) {
                  in = new BufferedInputStream(new FileInputStream
                          (inFolder.getPath() + "/" + files[i]), 1000);  
                  out.putNextEntry(new ZipEntry(files[i])); 
                  int count;
                  while((count = in.read(data,0,1000)) != -1) {
                      out.write(data, 0, count);
                  }
              }
  
              for (int i=0; i&lt;files1.length; i++) {
                  in = new BufferedInputStream(new FileInputStream
                          (inFolder1.getPath() + "/" + files1[i]), 1000);  
                  out.putNextEntry(new ZipEntry(files1[i])); 
                  int count;
                  while((count = in.read(data,0,1000)) != -1) {
                      out.write(data, 0, count);
                  }
              }
              out.closeEntry();
              out.flush();
              out.close();
  
          }
          catch(Exception e) {
              e.printStackTrace();
          } 
      }   
  }
  </code></pre>
  
  <p>In the above code, i'm getting all the files from ReportCharts folder. But i need to get only the .png files.</p>