Skip to content

Instantly share code, notes, and snippets.

@viniciusCamargo
Last active February 12, 2017 03:35
Show Gist options
  • Save viniciusCamargo/bc2fabd6bcd06c6f12c8a0c9e5224598 to your computer and use it in GitHub Desktop.
Save viniciusCamargo/bc2fabd6bcd06c6f12c8a0c9e5224598 to your computer and use it in GitHub Desktop.
Change file extension on the current directory from PHP to HTML
const fs = require('fs')
const cwd = process.cwd()
fs.readdir(cwd, 'utf8', (err, files) => {
if (err)
throw err
files.map(f => fs.rename(f, f.replace('php', 'html'), (err, file) => {
if (err)
throw err
}))
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment