Advertisement
Guest User

Untitled

a guest
Jan 28th, 2020
105
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. const fs = require('fs');
  2.  
  3. function parseFolder(path){
  4.     // console.log(path);
  5.     const files=fs.readdirSync(path); //lecture des fichiers dans le dossier 'path'
  6.     for(var file of files){
  7.         if(fs.lstatSync(path+'/'+file).isDirectory()){ //si DOSSIER
  8.             parseFolder(path+'/'+file);
  9.         }
  10.         else{ //SI FICHIER
  11.             console.log(file);
  12.         }
  13.     }
  14. }
  15.  
  16. parseFolder('.')
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement