0
파일을 복사하고 해당 특성을 표준으로 설정하고 파일 시간을 업데이트 한 다음 일치하도록 특성을 다시 설정하는 약간의 vb.net 스크립트가 있습니다. 소스 파일의 내용.System.IO는 파일을 복사하지만 대상 파일 특성을 업데이트하지 못합니다.
If IO.File.Exists(Destination) Then IO.File.SetAttributes(Destination, IO.FileAttributes.Normal)
IO.File.Copy(Source, Destination, True)
IO.File.SetAttributes(Destination, IO.FileAttributes.Normal)
IO.File.SetLastWriteTimeUtc(Destination, IO.File.GetLastWriteTimeUtc(Destination).AddHours(1))
IO.File.SetAttributes(Destination, IO.File.GetAttributes(Source))
그러나 나는 아주 이상한 문제에 봉착했습니다. 일부 구성의 경우 IO.File.SetLastWriteTimeUtc
은 IO.File.Copy
명령어가 제대로 작동했지만 UnauthorizedAccess 오류를 발생시킵니다.
저는 완전히 확인했습니다. 파일 속성 은이 128 (즉, 보통)으로 설정되었습니다. 문제는 바로 SetLastWriteTimeUtc
인 것으로 보입니다. 그러나 그것은 무엇입니까?
아이디어가 있으십니까?
감사합니다.
고마워요! 그러나 이것이 일어나는 이유를 아십니까? 내 컴퓨터에서 게스트 계정으로이 문제를 실험하지 않습니다. –
UAC가 문제를 해결하지 못했습니다 ... –