import fs from 'fs' fs.rename('C:/Users/ybx/Desktop/video-cut/1/', 'C:/Users/ybx/Desktop/video-cut/666/', (err) => { if (err) throw err; console.log('重命名完成'); });
同步:
fs.renameSync(旧路径,新路径)