1const fs = require('fs');
2var path = require("path");
3
4let files = fs.readdirSync('./'); // get all files
5
6files = files.filter(f => /^[1-9]{1}[.]/g.test(f)); // filter
7
8const filesToRename = files.map(f => { // map
9 return {
10 name: path.resolve(f),
11 new: path.resolve(0 + f)
12 }
13});
14
15filesToRename.forEach(f => {
16 fs.renameSync(f.name, f.new); // execute
17})