String dirname ="./"; File f1 =newFile(dirname); if(f1.isDirectory()){ System.out.println("Directory of "+dirname); FilenameFilter only =new FileAccept("bin"); String s[]=f1.list(only); for(int i =0;i<s.length;i++){ File f=newFile(dirname +"/"+s[i]); if(f.isDirectory()){ System.out.println(s[i]+" is a directory"); }else{ System.out.println(s[i]+" is a file"); } } } }