java遍历目录下的目录和文件
public static void findStrFromManyFiles(String dirName) throws IOException{ File dir = new File(dirName); File[] files = dir.listFiles(); for(int i=0;i<files.length;i++) { if(files[i].isFile()) { //操作文件 }else if(files[i].isDirectory()) { //System.out.println(files[i].getPath()); findStrFromManyFiles(files[i].getPath()); } } }
#########################