question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

copy and keep original folder structure

See original GitHub issue

i have a list of files to copy:

    gulp.src([list of js files])
      .pipe(gulp.dest(build_dir))

the files are copied, but flattened. how can i reserve original directory structure? i can’t find an option for that

Issue Analytics

  • State:closed
  • Created 10 years ago
  • Reactions:1
  • Comments:38 (16 by maintainers)

github_iconTop GitHub Comments

117reactions
jbdemontecommented, Apr 27, 2014

If you want to keep the sub-folders, you have to define the base in the options (2nd argument) e.g., to keep “assets/file.doc” in “dist/”:

    gulp.src(["assets/file.doc"], {base: "."})
        .pipe(gulp.dest("dist/"));
13reactions
yocontracommented, Apr 3, 2014

We are allowing functions in gulp.dest so you could do this

gulp.dest(function(file){
  return path.join(build_dir, path.dirname(file.path));
});

Track https://github.com/wearefractal/vinyl-fs/pull/15

Read more comments on GitHub >

github_iconTop Results From Across the Web

cp - Copy specific file type keeping the folder structure
Now I want to copy all *. csv files to another destination keeping the folder structure. It works by doing: cp --parents *....
Read more >
Copy Folder Structure without Copying Files in Windows
The built-in XCOPY command in Windows can copy the directory or directory tree (i.e., recursively). The switches /T /E make sure that only...
Read more >
How to copy an entire folder structure without copying the files ...
Now open a Windows command window and run the following command. It's the /T option that copies just the folder structure not the...
Read more >
How to copy files while maintaining original folder structure?
The best way I have found to transfer that kind of data while maintaining the folder structure is through Robocopy.
Read more >
How to copy a folder structure on Windows 10 - AddictiveTips
First, move the folder that you want to replicate the structure of, to a new folder that has nothing else in it. Open...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found