Skip to content

Instantly share code, notes, and snippets.

@piotros
Last active September 25, 2019 11:06
Show Gist options
  • Save piotros/0a00b58f5b216f6fa0bd200d987bdaeb to your computer and use it in GitHub Desktop.
Save piotros/0a00b58f5b216f6fa0bd200d987bdaeb to your computer and use it in GitHub Desktop.
Rename files tool
#!/usr/bin/env node
const FileHound = require('filehound');
const fs = require('fs');
const files = FileHound.create()
.paths('./application')
.ext('ftlh')
.find();
files.then(files => {
files.forEach(file => {
fs.rename(file, file + '.html', function(err) {
if ( err ) console.log('ERROR: ' + err);
});
});
});
{
"name": "rename-files",
"version": "0.0.0",
"bin": "./index.js",
"dependencies": {
"filehound": "latest"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment