System.IO.File.Copy
is failing when the source file has the read-only attribute set.
Copying to I get an error:
Access to the path
<destination>
is denied. (System.UnauthorizedAccessException)
I have a scenario where I am copying a template file to a destination path prior to modifying it, and for safety I'd rather the template was read-only.
Why can't I copy a read-only file in this way, and how can I achieve what I want most easily/sensibly? And... why is the exception about the destination file when this file is never created?
note: whether the copied file is read-only or not I don't care, that's easy to fix