public static void main(String[] args) {
// TODO code application logic here
new JavaTest().read("D:/java", "");
}
public void read(String path, String tab) {
File file = new File(path);
File[] childFiles = file.listFiles();
for (int i = 0; childFiles != null && i < childFiles.length; i++) {
System.err.println(tab + childFiles[i].getName());
if (childFiles[i].isDirectory()) {
read(childFiles[i].getPath(), tab + "\t");
}
}
}
//编程输出目录下所有目录及文件名称 目录之间用tab