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();
|
|
|
}
|
|
}
|