我有以下代码将文件从一个目录移动到另一个目录:
var fs = require('fs'),oldpath = 'firstfile.txt',newPath = 'temp/firstfile.txt'; fs.rename(oldpath,newPath,function (err) { console.log('rename callback ',err); });