clr-dir
Version:
A npm package to organize the directory quickly
19 lines (16 loc) • 452 B
JavaScript
const fs = require("fs");
const path = require("path");
const chalk = require("chalk");
module.exports = (oldDir, newDir, file) => {
const oldPath = path.join(oldDir, file);
const newPath = path.join(newDir, file);
return new Promise((resolve) => {
fs.rename(oldPath, newPath, () => {
resolve(
`${chalk.blueBright(file)} moved from ${chalk.red(
oldDir
)} -> ${chalk.green(newDir)}`
);
});
});
};