I am building an SSIS package that uses a script task to check if there is a file in a directory and if a file exists returns that file's name. This is what I've tried:
string pickUpPath = Dts.Variables["User::PickupPath"].Value.ToString();
if (File.Exists(pickUpPath))
{
Dts.Variables["User::ContinueExecution"].Value = false;
Dts.Variables["User::FileName"].Value = Path.GetFileName(pickUpPath);
}
else
{
Dts.Variables["User::ContinueExecution"].Value = true;
}
The PickupPath = \ServerName\Direcotry\PickupLoaction. So just the directory without the file. The file name always changes so I just want to check if there is a file in the folder. To throw another wrench into things there will always be a working and archive folder within the directory in question.
What I have isn't working. It always continues execution without returning the file name. I've also tired Direcotry.exists to no avail.
I'm not exactly sure how to pull this off and the pressure is mounting. Any suggestions?