import java.io.File;
public class FileTest {
public static void main(String[] args) {
//
File dir = new File("e:\\");
showDir(dir);
}
public static void showDir(File dir){
System.out.println("dir:"+dir);
File[] files = dir.listFiles();
for(File f:files){
if(f.isDirectory()){
showDir(f);//递归
}
else
System.out.println(f);
}
}
}
|