Search This Blog

Saturday, November 23, 2013

List of Files in the Directory with specified type

Pass the File Directory in the method and extension if you want to get the files with different file extensions.

 private File[] getJpgFiles(File f){

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

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

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.