Rename file in node js var fs = require('fs'); fs.rename('mynewfile3.txt', 'myrenamedfile.txt', function (err) { if (err) throw err; console.log('File Renamed!'); }); After save this file 'mynewfile3.txt' to 'myrenamedfile.txt'. Cook with me Share this content Opens in a new window X Opens in a new window Facebook Opens in a new window WhatsApp You Might Also Like Delete file in node js August 22, 2023 Event module in node js August 22, 2023 Update in mysql nodejs August 23, 2023 Leave a Reply Cancel replyCommentEnter your name or username to comment Enter your email address to comment Enter your website URL (optional) Save my name, email, and website in this browser for the next time I comment.