I am trying to make a directory with help of node.js it is giving me error Error: ENOENT: no such file or directory, mkdir '../regionalprocess/20220906/text'
I am trying to achieve is -
- first go to regionalprocess folder
- then create a folder with value of
${directorycreating[1] - and in
${directorycreating[1]create a folder text
I am trying to make a directory in regionalprocess folder with name of ${directorycreating[1] (this has some value) and in ${directorycreating[1] a folder name text
while creating folder with value ${directorycreating[1] this will work fine with below snippet code -
var dir = ../regionalprocess/${directoryCreating[1]};
but if I am trying to create a folder in ${directorycreating[1] with name text it is giving me an error
var dir = `../regionalprocess/${directoryCreating[1]}/text`;
if (!fs.existsSync(dir)) {
fs.mkdirSync(dir);
console.log("file created " + dir);
} else {
console.log("Error creating directory because it already exists");
}
so, exactly I am trying to create a directory in regionalprocess with name ${directoryCreating[1]} value and in this value I need to create text folder
regionalprocess + ${directoryCreating[1]} + text