文件夹下目录文件的迭代现实示例3
import java.io.*;
public class Test {
public static void List(File f) {
String[] name = f.list();
for (int i = 0; i < name.length; i++) {
File n = new File(f, name[i]);
System.out.println(f.getPath());
if (n.isDirectory())
List(n);
}
}
public static void main(String[] s) {
List(new File("e:/"));
}
}
public class Test {
public static void List(File f) {
String[] name = f.list();
for (int i = 0; i < name.length; i++) {
File n = new File(f, name[i]);
System.out.println(f.getPath());
if (n.isDirectory())
List(n);
}
}
public static void main(String[] s) {
List(new File("e:/"));
}
}