0

I am working on node.js app, I have list of folders to be archived in %APPDATA%/Archive/****/Licensing, **** is different versions.(v195,v196,v197 etc)

From APPDATA I want to loop through all the version folders, and inside version folder I want to grab only the licensing folder for different version folders.

Here is what I tried

//I am not sure, how to loop over here 
var archiver = require('archiver'); 

var FileList = path.resolve(process.env.LOCALAPPDATA,'..\\Roaming\\Archive\\****\\licensing');
archive.directory(File, "FileList");

RobC
  • 22,977
  • 20
  • 73
  • 80
karansys
  • 2,449
  • 7
  • 40
  • 78
  • Possible duplicate of [How do you get a list of the names of all files present in a directory in Node.js?](https://stackoverflow.com/questions/2727167/how-do-you-get-a-list-of-the-names-of-all-files-present-in-a-directory-in-node-j) – O. Jones Oct 14 '19 at 13:18
  • Thanks that did help me :) – karansys Oct 14 '19 at 13:37

1 Answers1

0
var SAnsysDebugFile = path.resolve(process.env.LOCALAPPDATA,'..\\Roaming\\Archive');
glob(SAnsysDebugFile+'/v***/licensing','', function (err, files) {
    if (err) {
     console.log(err);
    } else {
        console.log(files);
        for (let i in files) {
            sUsagefile = files[i];
            archive.directory(files[i], "Archive");
        }
      }
})
karansys
  • 2,449
  • 7
  • 40
  • 78