onlineracoon onlineracoon - 1 year ago 149
Javascript Question

Glob pattern - full directory except sub folders

Basically I'm creating a Gulp task which copies a folder and all it's sub folders, but I want it to skip 2 directories like so:

var gulp = require('gulp');

gulp.task('copy', function () {
return gulp.src(['./src/**', '!./src/scripts/', '!./src/styles/'])

But it won't work, it will copy the src directory including the src/scripts and src/styles sub folders.

How could I make it work that it would copy the src directory + sub folders (and sub - sub folders) except the src/scripts and src/styles folders.

Answer Source

I guess you could do something like

gulp.task('copy', function () {
  return gulp.src([

To exclude the scripts and styles folders, including all its contents

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download