private static long logStoreFiles(StringLogger.LineLogger logger, String prefix, File dir) { if (!dir.isDirectory()) return 0; File[] files = dir.listFiles(); if (files == null) { logger.logLine(prefix + "<INACCESSIBLE>"); return 0; } long total = 0; for (File file : files) { long size; String filename = file.getName(); if (file.isDirectory()) { logger.logLine(prefix + filename + ":"); size = logStoreFiles(logger, prefix + " ", file); filename = "- Total"; } else { size = file.length(); } logger.logLine(prefix + filename + ": " + Format.bytes(size)); total += size; } return total; }
private String time() { return Format.date(); }