search

Home  >  Q&A  >  body text

javascript - node.js How to cut all files in one folder to another folder

How to cut the files in viewsdev/node_modules, including node_modules, to another directory

  const path = require('path');
  const fs = require('fs');
 let modules = path.join(__dirname,'viewsdev/node_modules');
 let newModules = path.resolve(__dirname,'../../../node_modules');
 fs.rename(modules,newModules,function(err){
    if(err){
       console.log(err) 
    }
})

Using fs.rename will report the error EPERM: operation not permitted node

習慣沉默習慣沉默2773 days ago728

reply all(1)I'll reply

  • 伊谢尔伦

    伊谢尔伦2017-06-05 11:15:04

    Is it a permissions issue

    reply
    0
  • Cancelreply