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

26
LINES

< > BotCompany Repo | #1003844 // findAllFiles_noDirs (scans recursively, returns files only)

JavaX fragment (include)

1  
static L<File> findAllFiles_noDirs(L dirs) {
2  
  ret findAllFiles_noDirs(asObjectArray(dirs));
3  
}
4  
5  
// dirs are String's or File's
6  
static L<File> findAllFiles_noDirs(O... dirs) {
7  
  new L<File> l;
8  
  for ping (O dir : dirs) {
9  
    if (dir cast S && dir.endsWith("/.")) {
10  
      // "/." means non-recurse
11  
      for ping (File f : listFiles(dropSuffix("/.", dir)))
12  
        if (f.isFile()) l.add(f);
13  
    } else
14  
      findAllFiles_noDirs_impl(toFile(dir), l);
15  
  }
16  
  ret l;
17  
}
18  
19  
static void findAllFiles_noDirs_impl(File dir, L<File> l) {
20  
  for ping (File f : listFiles(dir)) {
21  
    if (f.isDirectory())
22  
      findAllFiles_noDirs_impl(f, l);
23  
    else
24  
      l.add(f);
25  
  }
26  
}

Author comment

Began life as a copy of #1001725

download  show line numbers  debug dex  old transpilations   

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

No comments. add comment

Snippet ID: #1003844
Snippet name: findAllFiles_noDirs (scans recursively, returns files only)
Eternal ID of this version: #1003844/3
Text MD5: 561a45742d98cdb4c28df9bf1513513d
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2021-09-30 05:30:14
Source code size: 683 bytes / 26 lines
Pitched / IR pitched: No / No
Views / Downloads: 637 / 657
Version history: 2 change(s)
Referenced in: [show references]