hparra / gulp-rename

Rename files easily
MIT License
692 stars 73 forks source link

how to delete old files? #66

Closed kyo4311 closed 8 years ago

kyo4311 commented 8 years ago
gulp.task('rename', function() {
    return gulp.src('./face/**/*.gif')
        .pipe(rename(function(path, index) {
            path.basename = path.basename.replace('_thumb', '');
        }))
        .pipe(gulp.dest('./face'));
});

rename a_thumb.gif to a.gif after renamed, i want delete the a_thumb.gif

yocontra commented 8 years ago

https://www.npmjs.com/package/gulp-rimraf before rename.

Questions like this belong on stackoverflow, btw

julesbou commented 5 years ago

would be great to provide an option to remove old files, for example:

rename({ replace: true })

like that it automatically removes old files.