Last active
April 8, 2018 03:57
-
-
Save coolicer/c02125d3437dd2b6642ac1f3a737a528 to your computer and use it in GitHub Desktop.
rename file
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const fs = require('fs'), path = require('path') | |
fs.readdirSync('./').filter(item => item.indexOf('.png') > 0) | |
.forEach((item, index) => { | |
let newItem = item.replace(/\.\w+\./, '.') | |
fs.renameSync(path.join(__dirname, item), path.join(__dirname, newItem)) | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment