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

19
LINES

< > BotCompany Repo | #1019094 // findDirsWithSizes (recurses)

JavaX fragment (include)

static L<FileWithSize> findDirsWithSizes(File dir) {
  new L<FileWithSize> out;
  findDirsWithSizes(dir, out);
  ret out;
}

svoid findDirsWithSizes(File dir, L<FileWithSize> out) {
  long clusterSize = assumedClusterSize();
  long n = 0;
  new L<FileWithSize> l2;
  for (File f : listFiles(dir))
    if (f.isDirectory())
      findDirsWithSizes(f, l2);
    else
      n += roundUpTo(clusterSize, f.length());
  for (FileWithSize f : l2) n += f.size;
  out.add(FileWithSize(dir, n));
  out.addAll(l2);
}

Author comment

Began life as a copy of #1010166

download  show line numbers  debug dex  old transpilations   

Travelled to 12 computer(s): bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, irmadwmeruwu, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt

No comments. add comment

Snippet ID: #1019094
Snippet name: findDirsWithSizes (recurses)
Eternal ID of this version: #1019094/4
Text MD5: a903aa02817a290b574f51443f63db89
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2018-10-23 16:51:57
Source code size: 521 bytes / 19 lines
Pitched / IR pitched: No / No
Views / Downloads: 315 / 366
Version history: 3 change(s)
Referenced in: [show references]