Skip to content

Instantly share code, notes, and snippets.

@Igloczek
Created May 19, 2018 11:46
Show Gist options
  • Save Igloczek/a87823e6f6782e4e87bb794d2ab7b285 to your computer and use it in GitHub Desktop.
Save Igloczek/a87823e6f6782e4e87bb794d2ab7b285 to your computer and use it in GitHub Desktop.
Quick way to capitalize bunch of file names

Remeber to use git config core.ignorecase false while you are on case insensitive partition

{
"dependencies": {
"glob": "*"
}
}
const fs = require('fs')
const glob = require('glob')
function capitalizeFirstLetter(string) {
return string.charAt(0).toUpperCase() + string.slice(1);
}
glob('core/components/**/*.js', (temp, files) => {
files.forEach(file => {
const name = file.match(/\w+\.js$/)[0]
fs.renameSync(
file,
file.replace(name, capitalizeFirstLetter(name))
)
})
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment