import java.io.*;
import java.nio.file.*;
public class IOTest3 {
public static void main(String[] args) throws Exception {
Path p = Paths.get("..", "HelloIdea");
printAll(p.normalize().toFile(), 0);
}
static void printAll(File f, int layer) throws Exception {
File[] fs = f.listFiles();
for(File file : fs) {
for(int i = 0; i < layer; i++ ) {
System.out.print(" ");
System.out.println(file.getName() + (file.isDirectory() ? "/" : ""));
if(file.isDirectory() && file.list().length > 0) {
printAll(file, layer + 1);
Sign in to make a reply
o_0
import java.io.*;
import java.nio.file.*;
public class IOTest3 {
public static void main(String[] args) throws Exception {
Path p = Paths.get("..", "HelloIdea");
printAll(p.normalize().toFile(), 0);
}
static void printAll(File f, int layer) throws Exception {
File[] fs = f.listFiles();
for(File file : fs) {
for(int i = 0; i < layer; i++ ) {
System.out.print(" ");
}
System.out.println(file.getName() + (file.isDirectory() ? "/" : ""));
if(file.isDirectory() && file.list().length > 0) {
printAll(file, layer + 1);
}
}
}
}