Skip to content

Commit f6dd382

Browse files
committed
Add good_filepaths function in workflow script
1 parent f2ab68e commit f6dd382

File tree

1 file changed

+36
-0
lines changed

1 file changed

+36
-0
lines changed

.github/workflows/script.js

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
// requiring path and fs modules
2+
const path = require('path');
3+
const fs = require('fs');
4+
5+
let URL_BASE = "https://github.com/TheAlgorithms/Javascript/blob/master";
6+
let g_output = [];
7+
8+
let filepaths = [];
9+
function good_filepaths(top_dir = ".") {
10+
fs.readdir(top_dir, function(err, list) {
11+
if (err) {
12+
console.log(err);
13+
return;
14+
}
15+
list.forEach(function(file) {
16+
let path = top_dir + "/" + file;
17+
if (!file.startsWith(".")) {
18+
fs.stat(path, function(err, stat) {
19+
if (stat && stat.isDirectory()) {
20+
good_filepaths(path);
21+
} else {
22+
if (file.toLowerCase().endsWith(".js")) {
23+
filepaths.push(path.slice(2));
24+
// console.log(filepaths);
25+
}
26+
}
27+
});
28+
}
29+
});
30+
})
31+
}
32+
33+
good_filepaths();
34+
setTimeout(() => {
35+
console.log(filepaths.length);
36+
}, 1000);

0 commit comments

Comments
 (0)