The following code proves that the file attributes are copied.
Dim sourceFile = "z.txt" Dim destinationFile = "x.txt" Using sw As IO.StreamWriter = IO.File.CreateText(sourceFile) sw.Write("testing") End Using IO.File.SetAttributes(sourceFile, IO.FileAttributes.ReadOnly) Debug.WriteLine("Source File ReadOnly = " & (IO.File.GetAttributes(sourceFile) And IO.FileAttributes.ReadOnly)) IO.File.Copy(sourceFile, destinationFile) Debug.WriteLine("Destination File ReadOnly = " & (IO.File.GetAttributes(destinationFile) And IO.FileAttributes.ReadOnly))
And just using Reflector, I see that IO.File.Copy uses the CopyFile function from kernel32.dll, which has documentation about what is copied and what is not: http://msdn.microsoft.com/en-us/ library / aa363851 (VS.85) .aspx
source share