| 1 | package fun; |
| 2 | |
| 3 | import java.io.File; |
| 4 | import java.io.FileNotFoundException; |
| 5 | import java.util.Scanner; |
| 6 | |
| 7 | public class Crunch { |
| 8 | |
| 9 | public static void main(String[] args) { |
| 10 | try { |
| 11 | Scanner scanner = new Scanner(new File(args[0])); |
| 12 | long total_size = 0; |
| 13 | |
| 14 | while (scanner.hasNextLine()) { |
| 15 | String line = scanner.nextLine(); |
| 16 | String[] splitLine = line.split("\\|"); |
| 17 | if(!splitLine[6].contains("F")) { |
| 18 | continue; |
| 19 | } |
| 20 | long size = Long.parseLong(splitLine[3]); |
| 21 | long atime = Long.parseLong(splitLine[11]); |
| 22 | long mtime = Long.parseLong(splitLine[12]); |
| 23 | |
| 24 | total_size+=size; |
| 25 | } |
| 26 | |
| 27 | System.out.printf("Total Size: %d TB = " +total_size, (total_size / 1024 / 1024 / 1024 / 1024)); |
| 28 | scanner.close(); |
| 29 | } catch (FileNotFoundException e) { |
| 30 | e.printStackTrace(); |
| 31 | } |
| 32 | } |
| 33 | |
| 34 | } |