|
@@ -8,6 +8,7 @@ import cn.hutool.http.HttpUtil;
|
|
import com.alibaba.fastjson.JSON;
|
|
import com.alibaba.fastjson.JSON;
|
|
import com.alibaba.fastjson.JSONObject;
|
|
import com.alibaba.fastjson.JSONObject;
|
|
import it.sauronsoftware.jave.*;
|
|
import it.sauronsoftware.jave.*;
|
|
|
|
+import org.apache.commons.lang3.ObjectUtils;
|
|
import org.bytedeco.javacpp.opencv_core;
|
|
import org.bytedeco.javacpp.opencv_core;
|
|
import org.bytedeco.javacv.FFmpegFrameGrabber;
|
|
import org.bytedeco.javacv.FFmpegFrameGrabber;
|
|
import org.bytedeco.javacv.Frame;
|
|
import org.bytedeco.javacv.Frame;
|
|
@@ -955,5 +956,31 @@ public class FileUtils {
|
|
return null;
|
|
return null;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ /**
|
|
|
|
+ * 获取文件数量
|
|
|
|
+ * @param file 文件夹
|
|
|
|
+ * @return
|
|
|
|
+ */
|
|
|
|
+ public static long getSubFileNums(File file) {
|
|
|
|
+ long total = 0L;
|
|
|
|
+ try {
|
|
|
|
+ if (ObjectUtils.isEmpty(file) || !file.exists()) {
|
|
|
|
+ log.error("文件夹不存在");
|
|
|
|
+ return 0;
|
|
|
|
+ }
|
|
|
|
+ File[] subFiles = file.listFiles();
|
|
|
|
+ for (File subFile : subFiles) {
|
|
|
|
+ if (subFile.isFile()) {
|
|
|
|
+ total++;
|
|
|
|
+ continue;
|
|
|
|
+ }
|
|
|
|
+ total = total + getSubFileNums(subFile);
|
|
|
|
+ }
|
|
|
|
+ } catch (Exception e) {
|
|
|
|
+ log.error("获取文件数量失败!" , e);
|
|
|
|
+ }
|
|
|
|
+ return total;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
|
|
}
|
|
}
|