MCPcopy Create free account
hub / github.com/Pagghiu/SaneCppLibraries / listFilesRecursive

Function listFilesRecursive

Support/SingleFileLibs/javascript/cli.js:50–64  ·  view source on GitHub ↗
(root)

Source from the content-addressed store, hash-verified

48async function writeText(path, content) { await fsWriteFile(path, content); }
49async function loadJSON(path) { return JSON.parse(await readText(path)); }
50function listFilesRecursive(root) {
51 const results = [];
52 function walk(dir) {
53 let names;
54 try { names = readdirSync(dir).sort(); } catch { return; }
55 for (const name of names) {
56 const full = join(dir, name);
57 let st;
58 try { st = statSync(full); } catch { continue; }
59 if (st.isDirectory()) walk(full); else results.push(full);
60 }
61 }
62 walk(root);
63 return results;
64}
65
66async function main() {
67 const args = parseArgs(process.argv);

Callers 1

listTreeFunction · 0.85

Calls 1

walkFunction · 0.85

Tested by

no test coverage detected