作者 朱兆平

开放目录监控接口

@@ -51,6 +51,20 @@ public final class FileTool { @@ -51,6 +51,20 @@ public final class FileTool {
51 } 51 }
52 return files; 52 return files;
53 } 53 }
  54 +
  55 + /**
  56 + * 获取目录下的所有文件
  57 + * @param dir
  58 + * @return
  59 + */
  60 + public static List<File> readAllDirectoryFiles(File dir){
  61 + List<File> files = new ArrayList<File>();
  62 + if (dir.exists() && dir.isDirectory()) {
  63 + files = (List<File>) FileUtils.listFiles(dir, null, false);
  64 + }
  65 + return files;
  66 + }
  67 +
54 public static void writeWaybill(String path,String content,String waybillNo){ 68 public static void writeWaybill(String path,String content,String waybillNo){
55 StringBuffer stringBuffer = new StringBuffer(); 69 StringBuffer stringBuffer = new StringBuffer();
56 stringBuffer.append(xmlRootDirectory).append("/").append(path).append("/").append(DateUtil.getToday()).append("/").append(waybillNo).append(".log"); 70 stringBuffer.append(xmlRootDirectory).append("/").append(path).append("/").append(DateUtil.getToday()).append("/").append(waybillNo).append(".log");