27 lines
678 B
Java
27 lines
678 B
Java
import java.io.File;
|
|
|
|
/**
|
|
* Repertoires
|
|
*/
|
|
public class Repertoires {
|
|
|
|
public static void main(String[] args) {
|
|
Tree<String> tree = new Tree<>();
|
|
File f = new File(args.length > 0 ? args[0] : ".");
|
|
tree.getRootNode().setValue(f.getName());
|
|
fillNode(tree.getRootNode(), f);
|
|
tree.showTree();
|
|
}
|
|
|
|
public static void fillNode(Node<String> node, File folder) {
|
|
for (File f : folder.listFiles()) {
|
|
Node<String> subNode = new Node<String>(f.getName());
|
|
|
|
if (f.isDirectory()) {
|
|
fillNode(subNode, f);
|
|
}
|
|
|
|
node.addSubNode(subNode);
|
|
}
|
|
}
|
|
} |