if (!seen.contains(this.directory)) {
seen.addElement(this.directory);
String[] files = directory.list();
String spaces = "";
for (int i = 0; i < indent; i++) spaces += " ";
for (int i = 0; i < files.length; i++) {
File f = new File(directory, files[i]);
if (f.isFile()) {
System.out.println(spaces + f.getName());
}
else { // it's another directory
DirList dl = new DirList(f, indent + 2);
dl.list();
}
}
}