你说的继续处理是什么意思?如果是处理文件的话,文件名加上路径才能使用呀。

解决方案 »

  1.   

    以下是我们项目中的一段代码,希望对你有用。public class TestFile {
    List<File> fileList = null;
    public void CollationFileToDB() {
    }
    public void getFileList(String path) {
    try {
    System.out.println("File Path: "+path);
    File curPath = new File(path);

    File[] curFiles = curPath.listFiles();
    fileList = new ArrayList<File>();
    for (int i = 0; i < curFiles.length; i++) {
    File curFile = curFiles[i];
    System.out.println("Current File Name : "+curFile.getName());
    if (curFile.getName().contains("tdb")) {
    fileList.add(curFile);
    }
    }
    } catch (Exception exp) {
    exp.printStackTrace();
    }
    }
    }
      

  2.   

    楼主是说自己能输出文件名了,但是想保存下来文件名继续后面使用对吧?
    楼上的应该能解决你的问题,我就不多说了