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)

static L<File> findAllFiles_noDirs(L dirs) {
  ret findAllFiles_noDirs(asObjectArray(dirs));
}

// dirs are String's or File's
static L<File> findAllFiles_noDirs(O... dirs) {
  new L<File> l;
  for ping (O dir : dirs) {
    if (dir cast S && dir.endsWith("/.")) {
      // "/." means non-recurse
      for ping (File f : listFiles(dropSuffix("/.", dir)))
        if (f.isFile()) l.add(f);
    } else
      findAllFiles_noDirs_impl(toFile(dir), l);
  }
  ret l;
}

static void findAllFiles_noDirs_impl(File dir, L<File> l) {
  for ping (File f : listFiles(dir)) {
    if (f.isDirectory())
      findAllFiles_noDirs_impl(f, l);
    else
      l.add(f);
  }
}

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: 636 / 656
Version history: 2 change(s)
Referenced in: [show references]