godzsa
godzsa

Reputation: 2395

Gulp: how to copy contents of a directory recursively, without the matched parent?

I'd like to copy the contents of a directory recursively, but without the parent directory (foo in my example).

gulp.task('copy', ['clean:tmp'], function() {
  return gulp.src(['src/foo/**/*'], {base:"src"})
    .pipe(gulp.dest('src/.tmp/'));
});

This produces the following hieararchy:

src/.tmp/foo/{contents}

But I would like to have it without the foo folder:

src/.tmp/{contents}

Upvotes: 0

Views: 402

Answers (1)

Jared Hooper
Jared Hooper

Reputation: 881

{ base: 'src/foo' }

Should solve your problem. You have to define the base explicitly.

Upvotes: 1

Related Questions