Q:

Gulp creates empty folder in dist for ignored directory

I'm excluding the content of the directories in gulp.src using the !  symbol, but the directories themselves are still included, for example: 
gulp.src(["./src/**", "! ./src/pages/**"], { base: "./src/" })
        .pipe(gulp.dest("./dist/"))

outputs 
dist ->
       pages

but I don't want the directory pages.  Any idea? 

A:

Exclude the directory explicitly:
gulp.src(["./src/**", "! ./src/pages", "! ./src/pages/**"], { base: "./src/" })
  .pipe(gulp.dest("./dist/"))

Alternatively you can also use brace expansion:
gulp.src(["./src/**", "! ./src/pages{/**,}"], { base: "./src/" })
  .pipe(gulp.dest("./dist/"))

