I have to run certain gulp task over multiple json files in a folder but the task would fetch files different location based on the filename.
I am able to run the task by passing the filename as an argument in cmd but I want to automate the script so that it would get executed for all the files in the src location.
gulp.task("writeJSON", function() {
dataObj = require("./src/data/" + argv["filename"] + ".json");
dataObjKeysList = require("./src/data/stats/" + argv["filename"] + ".json");
segregateData(dataObj, dataObjKeysList, tabspace, false);
gulp
.src("./src/metadata.html")
.pipe(rename(argv["filename"] + ".html"))
.pipe(gulp.dest("./src/output"));
});
Any help would be greatly appreciated.
I am able to resolve the above issue using node filestream. I found this useful article
Filewalker Source
Used the below utility function which take the directory path and callback as args.
Added the below execution in my gulp task