import java.io.File;
import java.io.IOException;
public class MassProductionTxt {
public static void main(String[] args) {
String[] kk = {"0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "a", "b", "c", "d", "e", "f"};
for (String s : kk) {
for (String value : kk) {
//生成文件夹名称 fileNames
String fileNames = "E:\\文\\" + s + value;
//files 返回布尔值
boolean files = new File(fileNames).mkdir();
if (files == true) {
for (String u : kk) {
for (String o : kk) {
String fileName = fileNames + "\\" + u + o + ".txt";
File file = new File(fileName);
try {
if (file.createNewFile()) {
System.out.println("创建文件成功!");
} else {
System.out.println("文件已经存在无需重复创建");
}
} catch (IOException e) {
e.printStackTrace();
}
}
}
}
}
}
}
}
java 批量创建文件夹与txt文件
最新推荐文章于 2024-05-17 13:22:08 发布