Hello All,
I am having issues with copy File. Below is the method.
When trying to copy the file from the source path to the destination path, it throws the error Could not find file ''. But the file exists in the path.
Please let me know as what is the issue in the below code.
private void CopyFile(string filename, string sourcePath, string destPath)
{
var targetPathFile = Path.Combine(destPath, filename);
var sourcePathFile = Path.Combine(sourcePath, filename);
if (!File.Exists(targetPathFile))
{
try
{
File.Copy(sourcePathFile, targetPathFile, true);
}
catch (Exception ex)
{
throw ex;
}
}
}
TIG