How to Write a Script with node

  node.js, question

Rename the folder and the files in the folder, and remove a character of the name inside. How to write this nodeJs?

Fs module is sufficient.
Fs.readdir can read the file names of all files in the folder, and fs.rename can rename the files.

fs.rename(oldPath, newPath, [callback(err)])

OldPath is the path of the old file and newPath is the path of the new file. for example, I want to add a serial number to all file names in a folder dist/js

var path = 'dist/js'
 Fs.rename(path plus fileName,path plus fileName plus index);