Skip to content

Instantly share code, notes, and snippets.

@TrainerGuy22
Created October 7, 2014 02:01
Show Gist options
  • Save TrainerGuy22/d1d547c41071ed324176 to your computer and use it in GitHub Desktop.
Save TrainerGuy22/d1d547c41071ed324176 to your computer and use it in GitHub Desktop.
function endsWith(str, suffix) {
return str.indexOf(suffix, str.length - suffix.length) !== -1;
}
var fs = require('fs');
fs.readdir(process.env.PWD, function(err, files) {
if(err) throw err;
files.forEach(function(obj) {
if(endsWith(obj, '.jar')) {
fs.rename(process.env.PWD + obj, process.env.PWD + obj.substring(obj.length - 4) + process.env.BUILD_NUMBER + '.jar', function(err) {
if(err) { throw err; }
});
}
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment