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
CodePudding user response:
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");
});
CodePudding user response:
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");
});
