MoveFileTo and CopyFileTo not working to mapped drive

I have a directory (tempFile) that I need to either move or copy to another directory (Dest). The directory tempFile exists, but Dest does not (but it’s parent does), but the name is the same. On macOS these work fine:

tempFile.MoveFileTo(Dest) tempFile.CopyFileTo(Dest)

On Windows, running under Parallels, Dest maps to a virtual drive with NativePath:

\\\\Mac\\Home\\Documents\\0000006566

Neither MoveFileTo nor CopyFileTo cause the directory to be moved or copied. There is no error and the destination folder is empty (not even created).
I have tried to move/copy to Dest.Parent, but still nothing gets through.

Is there a bug with mapped drives (as opposed to drive letters)? Or am I missing something in Windows?

The LastErrorCode for tempFile is 102.

documentation.xojo.com/index.php/FolderItem.LastErrorCode
Sorry, looks like 102 is an Access denied error. Not sure why it’s locked by Parallels.

I also see this problem in testing here on a windows network (so I don’t think its a parallels issue)

Assuming that MoveFileTo calls MoveFile internally https://msdn.microsoft.com/en-us/library/windows/desktop/aa365239(v=vs.85).aspx

“A new directory must be on the same drive.” and “The one caveat is that the MoveFile function will fail on directory moves when the destination is on a different volume.”

So MoveFileTo wont work.

And CopyFileTo doesn’t work on directories.

I’m just looking for an easy/better way to do this, I’ll let you know if I find something.

Thanks @JulianS I mainly need MoveFileTo on the same drive and it’s working now that Parallels sharing is off and I have write access to my Documents folder again.

Ah great :slight_smile: I couldn’t find much for moving to a network share anyway, so it would have been a call to robocopy or a recurse down the tree ick