public class Count { public static void main(String[] args) throws IOException { String filePath="F:\testPbToJson1,F:\testPbToJson2,F:\testPbToJson3"; String [] filepaths=filePath.split(","); for (String filepath : filepaths) { File file=new File(filepath); File [] files=file.listFiles(); int count=0; for (File file1 : files) { BufferedReader bufferedReader=new BufferedReader(new FileReader(file1)); while (bufferedReader.ready()){ String line=bufferedReader.readLine(); if(line.trim().equals("")){ continue; } count++; } System.out.print(count); System.out.print(","); } System.out.println("目录:"+filepath+"有数据"+count+"条"); } } }