Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

js get files

/*--------------------------------------------------------------------------------------
|  _______    _    _____ _             _ _           ________     ___   ___ ___  __     |
| |__   __|  (_)  / ____| |           | (_)         /  ____     |__  / _ \__ /_ |    |
|    | | __ _ _  | (___ | |_ _   _  __| |_  ___    /  / ___|       ) | | | | ) || |    |
|    | |/ _` | |  \___ | __| | | |/ _` | |/ _   |  | |       |   / /| | | |/ / | |    |
|    | | (_| | |  ____) | |_| |_| | (_| | | (_) | |  | |___    |  / /_| |_| / /_ | |    |
|    |_|\__,_|_| |_____/ \__|\__,_|\__,_|_|\___/     \____|  /  |____|\___/____||_|    |
|                                                   \________/                          |
--------------------------------------------------------------------------------------*/

const fs = require('fs');

function getFiles(dir, files_){
    files_ = files_ || [];
    var files = fs.readdirSync(dir);
    for (var i in files){
        var name = dir + '/' + files[i];
        if (fs.statSync(name).isDirectory()){
            console.log(`INFO: ${name}`)
            getFiles(name, files_);
        }
        else{
            files_.push(name);
        }
    }
    return files_;
}
getFiles(testFolder);
Comment

PREVIOUS NEXT
Code Example
Javascript :: fcm node 
Javascript :: Select First Element querySelector 
Javascript :: loop in javascript 
Javascript :: delete cookie 
Javascript :: how to add multiple style attributes in react element 
Javascript :: remote with post data jquery ajax example 
Javascript :: shopify guest login 
Javascript :: add a string regex in angular input 
Javascript :: video recorder using webrtc and javascript 
Javascript :: react native notify user for new version of app 
Javascript :: react convert table to pdf 
Javascript :: The JavaScript Apply() Function 
Javascript :: same file select angular second time not selected 
Javascript :: javascript remove item from url 
Javascript :: div diseaper going down 
Javascript :: javascript optional parameters 
Javascript :: schema mongoose 
Javascript :: robot js click 
Javascript :: emergency food 
Javascript :: filtering in javascript 
Javascript :: mongoose encrypt database using mongoose encrypt package 
Javascript :: how to access variables in a different script file 
Javascript :: jsx map with index 
Javascript :: ja display snippet from text string 
Javascript :: React Redux reducer crud 
Javascript :: paypal in react js 
Javascript :: date difference without weekends using moment js 
Javascript :: how to update specific key of an object in reducer 
Javascript :: objeto con método javascript 
Javascript :: javascript if 
ADD CONTENT
Topic
Content
Source link
Name
8+8 =