package test;
|
|
import org.yeshi.utils.FileUtil;
|
|
import java.io.File;
|
import java.io.IOException;
|
import java.util.HashSet;
|
import java.util.Set;
|
|
/**
|
* @author hxh
|
* @title: Test
|
* @description: TODO
|
* @date 2022/6/6 18:53
|
*/
|
public class Test {
|
|
public static void main(String[] args) throws IOException {
|
String dir = "C:\\Users\\Administrator\\Desktop\\ocr";
|
File[] fs = new File(dir).listFiles();
|
Set<String> md5Set = new HashSet<>();
|
for (File f : fs) {
|
if (f.isDirectory()) {
|
continue;
|
}
|
String md5 = FileUtil.getFileMD5(f);
|
if (md5Set.contains(md5)) {
|
f.delete();
|
} else {
|
md5Set.add(md5);
|
}
|
}
|
}
|
|
|
}
|