September 20th, 2013, 07:05 PM
Having trouble working with a Windows\System32 Folder
I have been working for two days trying to figure out what is my problem with copying files from the local C:\windows\system32\certsrv\certenroll folder to a UNC path.
My code working perfect if I use c:\source and c:\destination folders. But once I switch it to system32 I get this message from JIT
System.IO.DirectoryNotFoundException was unhandled
Message=Could not find a part of the path 'C:\Windows\System32\Certsrv\Certenroll'.
I disabled UAC on another server and still same issue.
So, one thing that I figure out is that a simple BrowseDialog box does not see all folders within system32 folder.
Has anyone come across this issue before.
string sourcePath1 = @"C:\Windows\System32\CertSrv\CertEnroll";
string targetPath1 = @"\\testserver\certs\certenroll";
//Source Path 1 Operations
foreach (var sourceFilePath in Directory.GetFiles(sourcePath1))
string fileName = Path.GetFileName(sourceFilePath);
string destinationFilePath = Path.Combine(targetPath1, fileName);
System.IO.File.Copy(sourceFilePath, destinationFilePath, true);
//If we need to overwrite files, write an if else statement
I also attached a screenshot of it for your review.
Thanks for any help.
September 21st, 2013, 08:41 PM
Re: Having trouble working with a Windows\System32 Folder
Does the folder exist?
Do you have permissions to access it?
Click Here to Expand Forum to Full Width
This is a CodeGuru survey question.