Not logged in.  Login/Logout/Register | List snippets | | Create snippet | Upload image | Upload data

24
LINES

< > BotCompany Repo | #1002584 // Program Data Sizes (on disk)

JavaX source code [tags: use-pretranspiled] - run with: x30.jar

Libraryless. Click here for Pure Java version (2698L/18K/59K).

!752

static int minSizeToShow = 100*1024; // 0.1 MB

answer {
  if "program data sizes" {
    L<File> dirs = allDataDirectories();
    new Map<S, Long> map;
    long total = 0, totalCount = 0;
    for (File dir : dirs) {
      long count = numberOfFiles(dir);
      long size = directorySize(dir);
      total += size;
      totalCount += count;
      S id = dir.getName();
      
      if (size >= minSizeToShow)
        map.put(id + ": " + formatDouble(toM_double(size), 1) + " MB (" + n(count, "file") + ") - " + getSnippetTitle_overBot(id), size);
    }
    ret slackSnippet(
      "Total files: " + totalCount + ", total size: " + formatDouble(toM_double(total), 1) + " MB, showing all programs above " + (minSizeToShow/1024) + " K\n" +
      fromLines(reversedList(keysSortedByValues(map))));
  }
}

Author comment

Began life as a copy of #1002039

download  show line numbers  debug dex  old transpilations   

Travelled to 13 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt

No comments. add comment

Snippet ID: #1002584
Snippet name: Program Data Sizes (on disk)
Eternal ID of this version: #1002584/1
Text MD5: 1155c769c579e394442ad246670b5dc8
Transpilation MD5: 23a8c1298891b9b3e999a9c37e5e46f1
Author: stefan
Category:
Type: JavaX source code
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2016-02-03 01:23:45
Source code size: 828 bytes / 24 lines
Pitched / IR pitched: No / No
Views / Downloads: 657 / 1099
Referenced in: [show references]