Skip to content

Commit

Permalink
Added mkdir command
Browse files Browse the repository at this point in the history
  • Loading branch information
hemanth-hk committed Mar 31, 2020
1 parent 5a60826 commit bc0da15
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions commands/mkdir.js
Original file line number Diff line number Diff line change
@@ -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;

0 comments on commit bc0da15

Please sign in to comment.