java TestListFiles测试

package org.lunzi.test.io;

import java.io.File;

public class TestListFiles {

public static void main(String[] args) {
listF(new File("e:/org"),0);
}

public static void listF(File f, int level) {
String preStr =
"";
for (int i = 0; i < level; i++)
preStr +=
"    ";
System.out.println(preStr + f.getName());
if (f.isDirectory()) {
File[] files = f.listFiles();
for (File childF : files) {
listF(childF, level + 1);
}
}
}

}

lunzi   2008-11-08 20:00:35 评论:0   阅读:254   引用:0

发表评论>>

署名发表(评论可管理,不必输入下面的姓名)

姓名:

主题:

内容: 最少15个,最长1000个字符

验证码: (如不清楚,请刷新)

Copyright@2004-2010 powered by YuLog