exportconstmoveFile = async (filename) => { let sourceFileFullPath = `${sourceDirectory}${filename}.md`; let destinationFileFullPath = `${destinationDirectory}${filename}.md`; // Check if folder exists before writing files there if (!fs.existsSync(destinationDirectory)) { fs.mkdirSync(destinationDirectory); }
// save the file as pathname.md fs.rename(sourceFileFullPath, destinationFileFullPath, (err) => { if (err) { console.log(err); returnfalse; } }); returntrue; }