ganti nama file di folder

const fs = require('fs');
var path = require("path");

let files = fs.readdirSync('./'); // get all files

files = files.filter(f => /^[1-9]{1}[.]/g.test(f)); // filter

const filesToRename = files.map(f => { // map
    return {
        name: path.resolve(f),
        new: path.resolve(0 + f)
    }
});

filesToRename.forEach(f => {
    fs.renameSync(f.name, f.new); // execute
})
Concerned Capybara