i am writing a code for copy one file from a location to another.
The code is as follows:
Scripting.FileSystemObject copyobj = new Scripting.FileSystemObject();
bool overWrite = true;
copyobj.CopyFile(file, copy_destination, overWrite);
when the code gets executed on CopyFile function is throws an execption as follows:
HRESULT: 0x800A0046 (CTL_E_PERMISSIONDENIED)
I am able to copy file from any location to my drives i.e. (c:\ or d:\) but this execption arises if i want to copy files into a folder i.e. c:\foldername or d:\foldername.
static void Main()
// Write initial contents of File B.
// "File B contents."
// Copy one file to a location where there is a file.
File.Copy("file-a.txt", "file-b.txt", true); // overwrite = true
// Display the contents of both files