I know I'm late for a party about this, but for someone else stumbling over this question, there is another way to do this, which seems pretty elegant in my eyes. I found it in this question
To exclude empty folders, I added { nodir: true } after the glob pattern.
Your general template might be like this (using Nick answer variables):
gulp.src(globs, { nodir: true }) .pipe(gulp.dest(folders.dest + '/' + module.folder));
The mine was as follows:
gulp.src(['src/**/*', '!src/scss/**/*.scss', '!src/js/**/*.js'], { nodir: true }) .pipe(gulp.dest('dev/'));
This selects all files from the src directory that are not scss or js files, and also does not copy empty folders from these two directories.
source share