Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.io.*;
- import java.util.*;
- public class NonRcTree {
- public static void main(String[] args) {
- File fp = null;
- Vector<File> vf = null;
- Vector<Integer> s = null;
- try {
- fp = new File(args[0]);
- } catch (ArrayIndexOutOfBoundsException e) {
- System.out.println("args error!");
- System.exit(0);
- }
- System.out.println("Punto di partenza : " + fp.toString());
- vf = new Vector<File>();
- s = new Vector<Integer>();
- if (!fp.isDirectory()) {
- System.out.println("arg: " + fp.toString() + " -> error!");
- System.exit(0);
- }
- vf.add(fp);
- s.add(0);
- int spazio = 0;
- String sp = null;
- while (!vf.isEmpty()) {
- sp = "";
- File [] fArray = vf.firstElement().listFiles();
- spazio = s.firstElement() +1;
- for (int i = 0; i < s.firstElement(); i++) sp += " ";
- System.out.println("DDD - " + sp + vf.firstElement().getName());
- for (File x: fArray) {
- if (x.isDirectory()) {
- vf.add(x);
- s.add(spazio);
- }
- else {
- if (!x.isHidden()) System.out.println("FFF - " + sp + " " + x.getName());
- }
- }
- vf.remove(vf.firstElement());
- s.remove(s.firstElement());
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement