Alone as an Island What’s the pride in being a Programmer?
Sep 11

Old code but thought this would be useful

package com.ml;

import java.io.File;
import java.io.FilenameFilter;

public class FileFilterTest {

public static void main(String[] args) {

FilenameFilter filter=new FilenameFilter(){
public boolean accept(File dir, String fileName) {
return fileName.endsWith("java");
}
};

File f=new File("D:/Programs/Code");
String [] fileList=f.list(filter);
for (int i=0;i<fileList.length;i++){
System.out.println(fileList[i]);
}
}

}

Share and Enjoy: These icons link to social bookmarking sites where readers can share and discover new web pages.
  • bodytext
  • Sphinn
  • del.icio.us
  • Facebook
  • Mixx
  • Google
  • De.lirio.us
  • description
  • Furl
  • Reddit
  • Slashdot
  • Spurl
  • StumbleUpon
  • Technorati
  • TwitThis

Tags: , , ,

Leave a Reply

Give your best to the world.