File tree Expand file tree Collapse file tree 1 file changed +36
-0
lines changed
Expand file tree Collapse file tree 1 file changed +36
-0
lines changed Original file line number Diff line number Diff line change 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 ) ;
You can’t perform that action at this time.
0 commit comments