demo_fs_rename.js:
var fs = require('fs'); //Rename the file "mynewfile1.txt" into "myrenamedfile.txt": fs.rename('mynewfile1.txt', 'myrenamedfile.txt', function (err) { if (err) throw err; console.log('File Renamed!'); });
C:\Users\My Name>node demo_fs_rename.js
File Renamed!