diff --git a/commands/mkdir.js b/commands/mkdir.js new file mode 100644 index 0000000..96892d7 --- /dev/null +++ b/commands/mkdir.js @@ -0,0 +1,20 @@ +//importing filesystem +const fs = require('fs'); + +//function making the directory +function mkdir(path, FolderName = "New") { + var new_path = path.concat(FolderName); + + fs.mkdir(new_path, (err) => { + if (err) { + console.log("Folder with this name already exists."); + } else { + console.log(`Folder ${FolderName} created`); + } + }); + + +} + +//exporting the mkdir function +module.exports = mkdir; \ No newline at end of file