-
-
Notifications
You must be signed in to change notification settings - Fork 7
Open
Description
I ran into problem with moving a folder for a physical drive to another (mounted) drive.
My application is running at D:\.
fsn.move('source\dir', 'T:\target\dir')
Error: EXDEV: cross-device link not permitted, rename 'D:\source\dir' -> 'T:\target\dir'
{
errno: -4037,
code: 'EXDEV',
syscall: 'rename',
path: 'D:\source\dir',
dest: 'T:\target\dir'
}
The workaround is
fsn.move(path.resolve('source\dir'), 'T:\target\dir')
Here is my pull request
I checked the implementation of fsn.move, it seems source and destination are resolved on the fly, but not everywhere. Is there a particular reason for that?
Lines 26 to 44 in 928bb20
| export async function move(source: string, destination: string, options: MoveOptions = {}): Promise<void> { | |
| const overwrite = options.overwrite || false; | |
| if (resolve(source) === resolve(destination)) return fsp.access(source); | |
| const myStat = await fsp.lstat(source); | |
| if (myStat.isDirectory() && isSrcKid(source, destination)) { | |
| throw new Error('FS-NEXTRA: Moving a parent directory into a child will result in an infinite loop.'); | |
| } | |
| await mkdirs(dirname(destination)); | |
| if (overwrite) { | |
| await remove(destination); | |
| } else if (await pathExists(destination)) { | |
| throw new Error('FS-NEXTRA: Destination already exists.'); | |
| } | |
| try { | |
| return await fsp.rename(source, destination); |
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels