-
Notifications
You must be signed in to change notification settings - Fork 0
/
DN12.java
38 lines (32 loc) · 1.01 KB
/
DN12.java
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
import java.io.File;
public class DN12 {
public static void main(String[] args){
File f = new File(args[0]);
System.out.println(f);
rec(f, 0);
}
public static boolean rec(File f, int someCounter) {
if(! f.isDirectory()) {
return false;
}
String lines="| ";
if (someCounter==0) {
lines = "";
} else {
for (int i=0; i < someCounter-1; i++) {
lines+=lines;
}
lines= " " + lines;
lines=lines.substring(0, lines.length() - 2);
}
for(File dir : f.listFiles()) {
//System.out.println(lines.length());
if (lines.length() > 11 && dir.isFile()) {
lines = lines.substring(0, lines.length()-3);
}
System.out.print(lines + " |___" + dir.getName() +"\n");
rec(dir, someCounter+1);
}
return true;
}
}