5

I have some files that I need to copy in another folder and then renaming all of them one by one. Is there any solution to rename all those files in the new folder one by one in synchronous way?

ArbaS
  • 53
  • 1
  • 5

1 Answers1

11

The function you're looking for is

fs.renameSync(old_file_path, new_file_path)

You can find it in the node documentation here

Remember you'll need to require in filesystem with const fs = require('fs') as well.

Shadow The GPT Wizard
  • 66,030
  • 26
  • 140
  • 208
OllysCoding
  • 312
  • 3
  • 11