给个例子吧
------解决方案--------------------
目录下都是.txt么?如果是用下面:
File f=new File( "C:\\upload ");
String[] s=f.list();
就可以了,
如果不是,加个filefilter就可以了
------解决方案--------------------
api啊api
------解决方案--------------------
把1楼的f.list()改为
File f=new File( "C:\\upload ");
final Pattern p = Pattern.compile( "\\w+\\.txt ");
String[] s=f.list(new FilenameFilter(){
public boolean accept(File dir,String name) {
return p.matcher(name).matches();
}
});