/*
文件名: DiGui.java
描述: 列出某个目录下面的所有子目录
*/
import java.io.*;
class DiGui {
static void getDir(String strPath) throws Exception {
try {
File f = new File(strPath);
if (f.isDirectory()) {
File[] fList = f.listFiles();
for (int j = 0; j < fList.length; j++) {
if (fList[j].isDirectory()) {
System.out.println("d/t" + fList[j].getPath());
getDir(fList[j].getPath()); }
if (fList[j].isFile()) {
System.out.println("f/t" + fList[j].getPath());
}
}
}
} catch (Exception e) {
System.out.println("Error: " + e);
}
}
public static void main(String[] args) {
String strPath = "e://java//workspace//MyJava//";
try {
getDir(strPath);
} catch (Exception e) {
}
}
}