import java.io.File;
import java.util.ArrayList;
public class FileSystem{ // private static ArrayList filelist = new ArrayList(); public static void refreshFileList(String strPath) { ArrayList filelist = new ArrayList(); File dir = new File(strPath); File[] files = dir.listFiles(); if (files == null) { System.out.println(""+strPath+"文件目录不存在或者文件目录下没有文件! "); return; } for (int i = 0; i < files.length; i++) { if (files[i].isDirectory()) { refreshFileList(files[i].getAbsolutePath()); } else { String strFileName = files[i].getAbsolutePath().toLowerCase(); System.out.println("文件路径:"+strFileName+" --- 文件名称:"+files[i].getName()); filelist.add(files[i].getAbsolutePath()); } } } public static void main(String[] args) { long a = System.currentTimeMillis(); refreshFileList("E:\\javaWP\\"); System.out.println(System.currentTimeMillis() - a); } }