Friday, August 30, 2013

List files in directory with specified type

The example List all 'jpg' files in given directoty:

 private File[] getJpgFiles(File f){
  File[] files = f.listFiles(new FilenameFilter(){

   @Override
   public boolean accept(File dir, String filename) {
    return filename.toLowerCase().endsWith(".jpg");
   }});
  
  return files;
 }


No comments: