Skip to content

Commit

Permalink
Added mv command
Browse files Browse the repository at this point in the history
  • Loading branch information
hemanth-hk committed Mar 31, 2020
1 parent 29fd28f commit 9974158
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions commands/mv.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
//importing filesystem
const fs = require('fs');

//function movinf the file
function mv(old_path, new_path) {
source = './'
var old_path_wrt = source.concat(old_path);
var new_path_wrt = source.concat(new_path);

fs.rename(old_path_wrt, new_path_wrt, (err) => {
if (err) {
console.log("Invalid path");
} else {
console.log("File moved");
}
});


}

//exporting the mv function
module.exports = mv;

0 comments on commit 9974158

Please sign in to comment.