Skip to content

Instantly share code, notes, and snippets.

@hpneo
hpneo / rename.js
Created January 2, 2016 16:36
Rename files using regexp and Node.js
var fs = require('fs'),
path = require('path'),
args = process.argv.slice(2),
dir = args[0],
match = RegExp(args[1], 'g'),
replace = args[2],
files;
files = fs.readdirSync(dir);