1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29
|
public class Liste {
public static void main (String args[]){
List l = new List();
File a = new File(args[0]);
rep(a,l);
for(int i=0;i<l.countItems();i++)
System.out.println(l.getItem(i));
}
public static List rep(File b,List l) {
do {
if (b.isDirectory()) break;
} while(true);
File[] membres = b.listFiles();
for(int i=0; i<membres.length; i++) {
if (membres[i].isFile()) {
l.add(membres[i].getName());
}
else {
File c = new File(b+"/"+membres[i].getName());
String c1 = b+"/"+membres[i].getName();
l.add(c1);
rep(c,l);
}
}
return l;
}
} |
Partager