nodejs remove directory code example
Example 1: nodejs make directory
var fs = require('fs');
var dir = './tmp';
if (!fs.existsSync(dir)){
fs.mkdirSync(dir);
}
// or if complains about existence and nesting doesn't matter:
var shell = require('shelljs');
shell.mkdir('-p', 'root/parent/tmp');
Example 2: delete dir nodejs
fs.rmdirSync(dir, { recursive: true });
Example 3: how to delete a folder using node js
fs.unlink('./node/myText.txt',function(){
fs.rmdir('node');
});
Example 4: remove directory command line
Rmdir "C:\myfolder"