1 package org.catacomb.util;
2
3 import java.io.File;
4
5 import org.catacomb.report.E;
6
7
8 public class FileLister {
9
10
11
12
13 public static void main(String[] argv) {
14 File f = new File(argv[0]);
15 E.info("listinig files and folders under " + f.getAbsolutePath());
16
17 listResources(f);
18 }
19
20
21
22
23
24 public static void listResources(String rtpath) {
25 listResources(new File(rtpath));
26 }
27
28 public static void listResources(File fpar) {
29 StringBuffer sbf = new StringBuffer();
30 StringBuffer sbd = new StringBuffer();
31 for (File f : fpar.listFiles()) {
32 if (f.getName().startsWith("_")) {
33
34 } else {
35 if (f.isDirectory()) {
36 listResources(f);
37 sbd.append(f.getName());
38 sbd.append("\n");
39 } else if (f.isFile()) {
40 sbf.append(f.getName());
41 sbf.append("\n");
42 }
43 }
44
45 }
46 FileUtil.writeStringToFile(sbf.toString(), new File(fpar, "_files.txt"));
47 FileUtil.writeStringToFile(sbd.toString(), new File(fpar, "_directories.txt"));
48
49
50
51 }
52
53
54
55 }