package practice;
import java.io.File;
public class Demo1 {
public static void main(String[] args) {
File file = new File("F:playzo");
System.out.println("|"+file);
// File file1 = new File("f:\\print");
File[] listFiles = file.listFiles();
for (File file2 : listFiles) {
if(!file2.isFile()){
File[] listFiles2 = file2.listFiles();
if(listFiles2.length==0){
String name = file2.getName();
System.out.println("| |"+name);
}else{
String name = file2.getName();
System.out.println("| \\"+name);
list_file(file2);
}
}else{
String name = file2.getName();
System.out.println("| |"+name);
}
}
}
private static void list_file(File file) {
// TODO Auto-generated method stub
File[] listFiles = file.listFiles();
for (File file2 : listFiles) {
if(file2.isFile()){
String name = file2.getName();
System.out.println("| | |"+name);
}else{
String name = file2.getName();
System.out.println("| | \\"+name);
}
}
}
}
|
|