zhuguifei
2025-04-28 442928123f63ee497d766f9a7a14f0a6ee067e25
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
package test;
 
import org.jeecg.common.util.MD5Util;
 
import java.io.File;
 
public class FileTest {
 
    public static void main(String[] args) {
        String path = "//192.168.0.9/研发技术文档";
        checkFile(path);
    }
 
 
    public static void checkFile(String path) {
        File file = new File(path);
        if (!file.exists()) {
            System.err.println("文件不存在!!");
        }
 
        File[] files = file.listFiles();
        if (files != null && files.length != 0) {
            for (int i = 0; i < files.length; i++) {
                File f = files[i];
 
 
                if (!"#recycle".equals(f.getName()) && !"$RECYCLE.BIN".equals(f.getName()) && !"System Volume Information".equals(f.getName())) {
 
                    if (f.isDirectory()) {
                        System.out.println(f.getPath());
                        checkFile(f.getPath());
                    } else {
                        try {
                            String md5 = MD5Util.getFileMD5(f);
                            String fileName = "";
                            int lastIndex = f.getName().lastIndexOf(".");
                            if (lastIndex <0) {
                                fileName = f.getName();
                            } else {
                                fileName = f.getName().substring(0, lastIndex);
                            }
                            if (!fileName.equals(md5)) {
                                System.out.println( fileName);
                                System.out.println(md5);
                            }
                        }catch (Exception e) {
                            System.out.println("文件名:【" + f.getName()+"】");
                            e.printStackTrace();
                        }
 
 
                    }
                }
            }
        }
    }
}