Not registered yet?
Register now! It is easy and done in 1 minute and gives you access to special discounts and much more!
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?
I believe you can do something like this:
const string sourcePath = @"c:\test.txt";
const string destinationPath = @"c:\test2.txt"
FileInfo sourceFileInfo = new FileInfo(sourcePath);
FileInfo destinationFileInfo = new FileInfo(destinationPath);
FileSecurity sourceFileSecurity = sourceFileInfo.GetAccessControl();
Works like a charm! Thanks!
Thanks for the above information.