Quantcast
Channel: SQL Server Integration Services forum
Viewing all articles
Browse latest Browse all 24688

try to delete a file, but SSIS think it is a path

$
0
0

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


Viewing all articles
Browse latest Browse all 24688

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>