Closed
Description
- Operating System: Windows 10 1909
- Node.js version: 14.2.0
fs-extra
version: 9.0.1
Moving a file or directory where the destination is in the root of a drive (e.g. D:\filename
) causes the operation to fail, as the move function attempts to mkdir the root of the drive.
const fs = require("fs-extra");
fs.moveSync("D:\\Source.txt", "D:\\Destination\\SomeFolder"); // succeeds
fs.moveSync("D:\\Source.txt", "D:\\Destination"); // fails
Error is as follows:
Uncaught Error: EPERM: operation not permitted, mkdir 'D:\'
at Object.mkdirSync (fs.js:940:3)
at module.exports.makeDirSync (---\node_modules\fs-extra\lib\mkdirs\make-dir.js:101:15)
at Object.moveSync (---\node_modules\fs-extra\lib\move-sync\move-sync.js:16:3) {
errno: -4048,
syscall: 'mkdir',
code: 'EPERM',
path: 'D:\\'
}