import java.io.File
import java.util.LinkedList
public class FileSystem {
public static void main(String[] args) {
long a = System.currentTimeMillis()
LinkedList list = new LinkedList()
File dir = new File("c:\\java\\")
File file[] = dir.listFiles()
for (int i = 0i <file.lengthi++) {
if (file[i].isDirectory())
list.add(file[i])
else
System.out.println(file[i].getAbsolutePath())
}
File tmp
while (!list.isEmpty()) {
tmp = list.removeFirst()
if (tmp.isDirectory()) {
file = tmp.listFiles()
if (file == null)
continue
for (int i = 0i <file.lengthi++) {
if (file[i].isDirectory())
list.add(file[i])
else
System.out.println(file[i].getAbsolutePath())
}
} else {
System.out.println(tmp.getAbsolutePath())
}
}
System.out.println(System.currentTimeMillis() - a)
}
}
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)