Skip to content

Instantly share code, notes, and snippets.

@kalepail
Last active December 14, 2015 21:08
Show Gist options
  • Save kalepail/169d64e5e1889f712289 to your computer and use it in GitHub Desktop.
Save kalepail/169d64e5e1889f712289 to your computer and use it in GitHub Desktop.
Rename files with Gulp
var gulp = require("gulp");
var rename = require("gulp-rename");
gulp.task('default', function() {
return gulp.src("./*.md")
.pipe(rename(function(path) {
path.basename = path.basename.replace(/(\D*\d{4}-\D*\d{2}-\D*\d{2})(-)/, "$1.");
}))
.pipe(gulp.dest("./renamed"));
});
{
"name": "gulp-rename",
"version": "1.0.0",
"main": "gulpfile.js",
"author": "Tyler van der Hoeven",
"devDependencies": {
"gulp": "^3.9.0",
"gulp-rename": "^1.2.2"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment