admin
2024-10-30 010ef2a907e66efd4702443c06cdd18f8a7ffa5b
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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
package com.hxh.spring.test;
 
import com.yeshi.buwan.util.FileUtil;
 
import java.io.File;
import java.io.FileInputStream;
import java.util.HashSet;
import java.util.Scanner;
import java.util.Set;
 
/**
 * @author hxh
 * @title: CopyTest
 * @description: TODO
 * @date 2022/1/5 15:56
 */
public class CopyTest {
 
 
    private static Set<String> getFileNames(String path) throws Exception {
        Set<String> sets = new HashSet<>();
        Scanner scanner = new Scanner(new FileInputStream(new File(path)));
        while (scanner.hasNextLine()) {
            sets.add(scanner.nextLine().trim());
        }
        scanner.close();
 
        return sets;
    }
 
    private static void copyLayout() throws Exception {
        Set<String> sets = getFileNames("C:\\Users\\Administrator\\Desktop\\新建文件夹 (3)\\layout.txt");
 
        String fromBaseDir = "D:\\workspace\\Android\\buwan\\old\\HanJuPlayer\\app\\res\\layout\\";
        String toBaseDir = "C:\\Users\\Administrator\\Downloads\\android\\ZhiBo\\app\\src\\main\\res\\layout\\";
        String type = ".xml";
        for (String name : sets) {
            FileUtil.copyFile(fromBaseDir + name + type, toBaseDir + name + type);
        }
 
    }
 
    private static void copyImage() throws Exception {
        Set<String> sets = getFileNames("C:\\Users\\Administrator\\Desktop\\新建文件夹 (3)\\drawable-xhdpi.txt");
 
        String fromBaseDir = "D:\\workspace\\Android\\buwan\\old\\HanJuPlayer\\app\\res\\drawable-xhdpi\\";
        String toBaseDir = "C:\\Users\\Administrator\\Downloads\\android\\ZhiBo\\app\\src\\main\\res\\drawable-xhdpi\\";
        String type = ".png";
        for (String name : sets) {
            FileUtil.copyFile(fromBaseDir + name + type, toBaseDir + name + type);
        }
 
    }
 
    private static void copyDrawable() throws Exception {
        Set<String> sets = getFileNames("C:\\Users\\Administrator\\Desktop\\新建文件夹 (3)\\drawable.txt");
 
        String fromBaseDir = "D:\\workspace\\Android\\buwan\\old\\HanJuPlayer\\app\\res\\drawable\\";
        String toBaseDir = "C:\\Users\\Administrator\\Downloads\\android\\ZhiBo\\app\\src\\main\\res\\drawable\\";
        String type = ".xml";
        for (String name : sets) {
            FileUtil.copyFile(fromBaseDir + name + type, toBaseDir + name + type);
        }
 
    }
 
    public static void main(String[] args) throws Exception {
 
        copyImage();
 
 
    }
 
}