java扫描操作部分文件
public void findStrFromManyFiles(String dirName,String endStr) throws IOException{ File dir = new File(dirName); File[] files = dir.listFiles(); for(int i=0;i<files.length;i++) { if(files[i].isFile()) { String indexFileName = files[i].getName(); if(indexFileName.endsWith(endStr)) { //操作 } }else if(files[i].isDirectory()) { findStrFromManyFiles(files[i].getPath()); } } }
#############################
标签:文件,java,String,扫描,File,dirName,dir From: https://www.cnblogs.com/herd/p/16260782.html