var fs = require('fs'); fs.rename('sample_old.txt', 'sample_new.txt', function (err) { if (err) throw err; console.log('File Renamed.'); });