I have a process that reads file with different extension, at the end I will either move or delete the file. Below is the code.
I can run it with success if debug locally, it failed when trying to run the package. Below is the error:
The file received does not have extension - item_2290.seq
Error message: Access to the path 'E:\myfolder\item_2290.seq' is denied.
I tried different method and none worked, on if I delete the driectory. I donot want to recreate the dir each time. Please help, I am pulling my hair and no luck.
Below is the code:
foreach
(var srcfileinnewDirectoryInfo(SourceFilePath).GetFiles())
{
if (File.Exists(targetFilePath+ srcfile.Name) == true)
{
srcfile.Delete();
}
else
{
File.Move(SourceFilePath + srcfile.Name, targetFilePath + srcfile.Name);
}
}
W.E. Pan