1

How do I move files using Gulp from different folders in my src directory into the dist folder without keeping the directory structure from src.

For eg:

var sourceFiles = [
  "src/folder1/test.js",
  "src/folder1/test1.js"
];

should be moved to the dist folder i.e:

dist/test.js
dist/test1.js

Using something like this:

gulp.task("moveFiles",function(){
    return gulp.src(sourceFiles, {base: "src"})
      .pipe(gulp.dest("dist"));
});

moves it to dist/folder1 ie

dist/folder1/test.js
dist/folder1/test1.js
takeradi
  • 3,661
  • 7
  • 29
  • 53
  • Check if this post helps [Can you remove a folder structure when copying files in gulp?](http://stackoverflow.com/questions/24658011/can-you-remove-a-folder-structure-when-copying-files-in-gulp) – rmjoia Feb 05 '16 at 19:27
  • thanks @rmjoia. thats one of the options but i ended up using it by modifying the base option. please see answer below. – takeradi Feb 05 '16 at 19:47

1 Answers1

0

I ended up solving the issue without using the base option:

gulp.task("moveFiles",function(){
    return gulp.src(sourceFiles)
      .pipe(gulp.dest("dist"));
});
takeradi
  • 3,661
  • 7
  • 29
  • 53
  • the awesomeness of this, is that, there are a lot of solutions :) glad to know that you managed to solve the issue :) – rmjoia Feb 05 '16 at 19:49