Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

168
Views
How to copy all images from a src folder to a dist folder recursively using copy files npm module?

Using the copy files command, how can I copy images (.png, .jpg) from a "src" folder to the "dist" folder, while preserving the same filepaths internally. Should also work recursively.

https://www.npmjs.com/package/copyfiles

I have this

copyfiles(["src/**/*.png", "dist"], {u:2}, (err) => {
    if (err) {
        console.log("Error occurred while copying", err);
    }
    console.log("folder(s) copied to destination");
});

But it doesn't seem to work. It creates the src folder inside dist folder.

Thanks

about 4 years ago · Juan Pablo Isaza
2 answers
Answer question

0

Figured it out

copyfiles(["src/**/*.png", "dist"], 1, (err) => {
    if (err) {
        console.log("Error occurred while copying", err);
    }
    console.log("folder(s) copied to destination");
});
about 4 years ago · Juan Pablo Isaza Report

0

Accroding to the documentation in the README of copyfiles, if you want to provide options to copyfiles as an object, you should provide full names of options:

const copyOptions = { up: true, error: true };
copyfiles(["src/**/*.png", "dist"], copyOptions, (err) => {
    if (err) {
        return console.log("Error occurred while copying", err);
    }
    console.log("folder(s) copied to destination");
});
about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!