Created
April 5, 2017 01:32
-
-
Save cacheflow/eb59695d25ac2943e2f81cc865b81380 to your computer and use it in GitHub Desktop.
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
var fs = require('fs') | |
var path = require('path'); | |
var imagePath = path.resolve(process.cwd(), 'assets/images') | |
console.log("starting script") | |
fs.readdir(imagePath, ((err, files) => { | |
files.filter(file => file.includes('@')).forEach((file) => { | |
var fileSplit = file.split('@') | |
var newImagePath = path.resolve(imagePath, fileSplit[0] + '.png') | |
var oldImagepath = path.resolve(imagePath, file) | |
fs.rename(oldImagepath, newImagePath, (err) => { | |
if(err) { | |
console.log(err) | |
} | |
}) | |
}) | |
})) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment