Copy a file with its original permissions
When using the File.Copy() method the file is copied to its new directory however it loses its original permissions. Is there a way to copy a file so that it doesn't lose the permissions? Alex Mendez I believe you can do something like this: const string sourcePath = @"c:\test.txt"; const string destinationPath = @"c:\test2.txt" File.Copy(sourcePath, destinationPath); FileInfo sourceFileInfo = new FileInfo(sourcePath); FileInfo destinationFileInfo = new FileInfo(destinationPath); FileSecurity sourceFileSecurity = sourceFileInfo.GetAccessControl(); sourceFileSecurity.SetAccessRuleProtection