作者在 2010-06-03 14:32:16 发布以下内容
public static void main(String[] args) throws Exception {
// String f="d:"+File.separator+"data"+File.separator+"fword.txt";
String f="d:"+File.separator+"data";
File m=new File(f);
String[] s=m.list(new FilenameFilter(){
public boolean accept(File dir, String name) {
int m=name.indexOf(".java");
int k=name.indexOf(".txt");
return m!=-1||k!=-1;
}
});
for(int i=0;i<s.length;i++){
System.out.println(s[i]);
}
}
}
// String f="d:"+File.separator+"data"+File.separator+"fword.txt";
String f="d:"+File.separator+"data";
File m=new File(f);
String[] s=m.list(new FilenameFilter(){
public boolean accept(File dir, String name) {
int m=name.indexOf(".java");
int k=name.indexOf(".txt");
return m!=-1||k!=-1;
}
});
for(int i=0;i<s.length;i++){
System.out.println(s[i]);
}
}
}