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

19
LINES

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

JavaX fragment (include)

1  
static L<FileWithSize> findDirsWithSizes(File dir) {
2  
  new L<FileWithSize> out;
3  
  findDirsWithSizes(dir, out);
4  
  ret out;
5  
}
6  
7  
svoid findDirsWithSizes(File dir, L<FileWithSize> out) {
8  
  long clusterSize = assumedClusterSize();
9  
  long n = 0;
10  
  new L<FileWithSize> l2;
11  
  for (File f : listFiles(dir))
12  
    if (f.isDirectory())
13  
      findDirsWithSizes(f, l2);
14  
    else
15  
      n += roundUpTo(clusterSize, f.length());
16  
  for (FileWithSize f : l2) n += f.size;
17  
  out.add(FileWithSize(dir, n));
18  
  out.addAll(l2);
19  
}

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: 258 / 306
Version history: 3 change(s)
Referenced in: [show references]