-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathGenerate.java
More file actions
36 lines (35 loc) · 1.18 KB
/
Copy pathGenerate.java
File metadata and controls
36 lines (35 loc) · 1.18 KB
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
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
/**
* Created by houruhou on 2019/8/26.
* Desc:
*/
public class Generate {
public static void main(String[] args) throws IOException {
File summary = new File("summary.md");
if (!summary.exists()) {
summary.createNewFile();
}
FileOutputStream summaryOutput = new FileOutputStream(summary);
summaryOutput.write("# summary\n\n".getBytes());
summaryOutput.write("* [Introduction](readme.md)\n".getBytes());
File solutions = new File("solutions");
if (!solutions.exists()) {
solutions.mkdir();
}
for (int i = 1; i <= 300; i++) {
String ist = String.format("L%04d", i);
String mdFileName = ist + ".md";
String fName = String.format("solutions/%s.md",ist);
File tmp = new File(mdFileName);
if (!tmp.exists()) {
tmp.createNewFile();
}
String str = String.format("\t* [%s](%s)\n", ist, fName);
summaryOutput.write(str.getBytes());
}
summaryOutput.flush();
summaryOutput.close();
}
}