EDIT: I just realized my previous answer wouldn't work. I am posting new code.
If you just have two specified folders and want to merge their content, it would be pretty straightforward with gulp (this assumes that the folder names are known before and don't change):
var gulp = require('gulp');
gulp.task('moveBase',function(){
return gulp.src('BaseFolder/*')
.pipe(gulp.dest('ResultFolder/'));
});
gulp.task('moveExtended',['moveBase'],function(){
return gulp.src('ExtendedFolder/*')
.pipe(gulp.dest('ResultFolder/'));
});
gulp.task('mergeFolders',['moveBase','moveExtended']);
The files in BaseFolder
having the same names as files in ExtendedFolder
get overwritten.
The key here is the order of copying. First, copy the folder whose files should be overwritten in case of a conflict. You can split the copying into two tasks and take advantage of the dependency system - task moveExtended
depends on moveBase
which ensures that it will be copied later.