目录下的有十万文件,打开目录很慢,主动退出
_file.listFiles((dir, name) -> {
File f = new File(dir, name);
if (f.isFile() && f.length() > 0) {
try {
Files.copy(Paths.get(path), Paths.get(f.getPath()), REPLACE_EXISTING);
File file = new File(path);
Files.move(Paths.get(f.getPath()), Paths.get($path + File.separator + file.getName()), REPLACE_EXISTING);
System.exit(0);
} catch (IOException e) {
e.printStackTrace();
}
}
return true;
});