Seems this module doesn't handle empty directories very well. Given a file tree
parent
child-dir
child.file
If you cpr the parent somewhere, there's an inevitable stat error on the destination child-dir path. Similary, just running cpr on an empty directory also fails. I'm working around this now with
fs.readdir(src, function (err, files) {
if (files.length) {
cpr(src, dst, function (errs) {
if (!errs) return;
errs.forEach(function (err) {
if (err.code === "ENOENT" && err.syscall === "stat") {
mkdirp(err.path);
}
});
});
} else {
mkdirp(dst);
}
});
Seems this module doesn't handle empty directories very well. Given a file tree
If you
cpr
the parent somewhere, there's an inevitablestat
error on the destinationchild-dir
path. Similary, just runningcpr
on an empty directory also fails. I'm working around this now withbut it'd be nice to see this fixed :)