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.readdir(path,function(err,files),index{
 files.forEach(function(fileName){
 Fs.rename(path plus fileName,path plus fileName plus index);
 })
 
 })