Problem with SSIS Variable Expression containing getDate()

ssis

Brief Architecture

My SSIS package is generating dynamic excel files through Data flow. The file name format is "XYZ_Year_Month_Day_Hour_Minutes.xlsx". So I am using variable with expression which uses getDate() to generate above mentioned format.

Problem

I am writing file, using variable name generated through getDate(). Example: "XYZ_2014-8-1_03_30". In control flow I want to access same file in File System task to copy it to FTP.
But by time the variable changes its value to "XYZ_2014-8-1_03_32", so unable to locate file.

I tried with System::StartTime, but it stays same throughout package execution and all files get same name.

Is there any way we can store DateTime in a variable & it won't change further?

Best Answer

You could use a script task to set the variable property:

Dts.Variables["uVarDateStamp"].Value = DateTime.Date;