0

I have a directory containing a bunch of folders, all having an html,css and js file inside. I need some way to get like an array of all of these folder in order to access their data and using it in another html file using javascript. ex: this is my directory:

  currentDirectory>
         folder1>
               htmlFile
               cssFile
               jsFile
         folder2>
               htmlFile
               cssFile
               jsFile
         folder3>
               htmlFile
               cssFile
               jsFile
         etc...

I would need to fill up something like this:

let foldersInCurrentDirectory = [
                  {
                      RelativePath: '',
                      htmlFileName: '',
                      cssFileName : '',
                      jsFileName  : '',
                      
                   },
                   {
                      RelativePath: '',
                      htmlFileName: '',
                      cssFileName : '',
                      jsFileName  : '',
                      
                   },
                   {
                     //and so on.....
                   }
              ];
RANDOM NAME
  • 41
  • 1
  • 6
  • Just manual type the name in. You can't do it with plain JS. Maybe node.js would be a better option. –  Jun 21 '21 at 22:54
  • @TobyHarnish is there a way to like get the data with node and send it to a plain js file? – RANDOM NAME Jun 21 '21 at 23:03
  • https://stackoverflow.com/questions/5827612/node-js-fs-readdir-recursive-directory-search – Ace Jun 21 '21 at 23:27

0 Answers0