Closed george-thomas-hill closed 2 years ago
Yep, looks like a bug. @manidlou?
This is not a bug, it is an expected behavior. For directories, fs-extra
copies everything inside the directory (not the directory itself). It is also mentioned in our docs https://github.com/jprichardson/node-fs-extra/blob/master/docs/copy.md.
To clarify, you're copying the contents of sourceDir/testDir
to destDir/testDir
, so if a file or directory already exists inside destDir/testDir
with the same name as the one inside the sourceDir/testDir
, then you would get an error.
:man_facepalming: I feel silly; I did know that, but I somehow forgot about it when I replied.
fs-extra
version: 10.1.0Copying a directory to a path that already has a directory with that name does not throw an error even when options are set correctly.
Here is the relevant output from my terminal:
As you see, fs-extra reports success even though it should have thrown an error, since "testDir" already existed at "destDir".
Please let me know if I'm missing something or if I'm doing something incorrectly!
Thank you.