Open oupala opened 7 years ago
Any update ?
I think this bug comes from the fact that the flatten option is inconsistent if the glob matches a single file or multiple files. If you always specify the flatten option, you'll get the expected results:
No flatten option (commented out)
copy('path/to/a/file', 'dest', /*{flatten: false},*/ function (err, files) {
// dest/path/to/a/file
});
copy('path/to/a/file*', 'dest', /*{flatten: true},*/ function (err, files) {
// dest/file
});
Flatten option (inversed from above)
copy('path/to/a/file', 'dest', {flatten: true}, function (err, files) {
// dest/file
});
copy('path/to/a/file*', 'dest', {flatten: false}, function (err, files) {
// dest/path/to/a/file
});
I've just noticed a wrong behavior on windows when using glob "*".
The main objective is to copy the file
file
and its tree to the destination directory (dest1
ordest2
).When using a full path to specify which files to copy, everything goes well.
The result is that the file
file
is copied with is whole tree.When using a glob pattern *""** to specify multiple files to copy, things get worse.
The result is that the file
file
is copied but without its tree.This bug does not happen on linux.