파일 속성에 보관 속성 혹은 읽기 전용 속성이 켜져있는 경우, 해당 오류가 난다면 다음의 방법이 통할 수 있습니다.



--------------------------------------------------------------------------------------------------------------





The problem can be that you can not delete or overwrite read-only files. The solution is to change the attributes.

if(File.Exists(destFile))
{
    File.SetAttributes(destFile, FileAttributes.Normal);
}
File.Copy(sourcePath, destFile, true); 



----------------------------------------------------------------------------------------------------------------

+ Recent posts