Convert Files and Folders Structures to Bash Scripts, with NodeJS

1 · Alex Adam · July 22, 2021, 2:55 p.m.
This is a simple NodeJS app that takes a source folder as input and generates a Bash script. The Bash script has all the files’ content and the folders’ structure in the source folder and it can recreate them when executed.Source code available here: https://github.com/alexadam/folders-to-scriptFirst step, iterate through all files in the source folder:const fs = require("fs")const path = require("path")const listFiles = (dirPath, result) => { files = fs.readdirSync(dirPath) result = result || [...