I'm extracting an ISO and then copying a folder from the extracted ISO. The problem is that the extracted files are read-only. I've tried changing it from the properties menu, and from code in c#. Neither worked.
The code I used for extracting the ISO is in another question: extract ISO with winrar automatically with c# or batch
I'm looking for a way to either change the attributes of the extracted ISO so that I can copy from its subfolders, or to just change the sub folders permissons.
Thanks in advance
UPDATE
new code
string[] folderToName = txtCopyFrom.Text.Split('\\');
string isoName = folderToName[folderToName.Length - 1];
isoName = isoName.Remove(isoName.Length - 4, 4);
string copyTestFrom = txtCopyTo.Text + @"\"+ isoName + @"\Test\subTest";
string[] folderName = txtCopyFrom.Text.Split('\\');
string folderTestTo = folderName[folderName.Length - 1];
folderTestTo = folderTestTo.Remove(folderTestTo.Length - 4, 4);
string copyTest = txtCopyTo.Text;
System.IO.Directory.CreateDirectory(copyTest);
DirectoryInfo di = new DirectoryInfo(copyTestFrom);
di.Attributes &= ~FileAttributes.ReadOnly;
foreach (FileInfo fi in di.GetFiles())
{
fi.IsReadOnly = false;
string destinationPath = Path.Combine(copyTest, Path.GetFileName(copyTestFrom));
File.Copy(copyTestFrom, destinationPath);
}
MessageBox.Show("Files Copied");
The files in subTest are not read only, only the folder itself is.
Destination path goes to C:\users\mydocs\ISODump\subTest
After access denied
exception is thrown I can still copy the folder manually
UPDATE 2
workaround
Found a work around, for my purposes. directory.move
achieves the purpose I wanted by moving the folder, instead of copying it.
Thanks