import java.io.File; import java.io.IOException; /** * 文件对比复制 * @author JIANGYOUYAO * @date 2021/6/7 0007 */ public class findC { static String targetFilePath="C:/"; static Long _1mb=1024L*1024L; public static void main(String[] args) throws IOException { File sourceFile=new File(targetFilePath); traverseFolder(sourceFile); } public static void traverseFolder(File file) throws IOException { if (file.exists()) { File[] files = file.listFiles(); if (null == files || files.length == 0) { return; } else { for (File file2 : files) { if (file2.isDirectory()) { traverseFolder(file2); } else { if(file2.length()>_1mb*50){ System.out.println( file2.length()/_1mb+"MB"+"\t"+file2.getAbsolutePath()); } } } } } else { System.out.println("文件不存在!"); } } }