-
Notifications
You must be signed in to change notification settings - Fork 5.4k
Closed
Description
After upgrading from 3.1 to 5 a program stopped working on ubuntu (both 18 and 20.04) that relies heavily on File.Move to move files across two different CIFS shares (with Windows as the host).
I upgraded cifs-utils but to no avail: the file seems to have been copied all right but then it throws the following error:
System.UnauthorizedAccessException exception - Access to the path is denied.
I assume this happens when the API call tries to delete the original file. I can delete that file manually with File.Delete - so it doesn't seem to be a permission issue.
I now changed the code which seems to work:
/*if (File.Exists(localFileName))
{
File.Delete(localFileName);
}
File.Move(tempFN, localFileName);*/
var arr = File.ReadAllBytes(tempFN);
File.WriteAllBytes(localFileName, arr);
File.Delete(tempFN);
But the original way should work too and seems much faster if the two files are on the same drive.
Reactions are currently unavailable