Q:

Set dynamic variable day in SSIS Package

I hope you can help me on this! I really appreciate the help from here!
What I'm trying to do is create SSIS package to import a .TXT delimited file into a database. The procedure for doing this with a static file is clear in my mind, but the thing here is that the import has to be done using a file from yesterday, every day.
The file name has this structure: "Informe_De_Recupero_D141027" (with the date part being "141027").
I've created a variable on the SSIS package called FileDateName with the following expression: 
RIGHT( "00" + (DT_STR, 4 , 1252)DATEPART( "year" , GETDATE() ),2) + "" 
+ RIGHT( "00" + (DT_STR, 2 , 1252)DATEPART( "month" , GETDATE() ) , 2 ) 
+ "" + (DT_STR, 2 , 1252) DATEPART( "day" , getdate()-1) 

But The -1 doesn't work in this scenario. It causes the following error: 

The data type "DT_DBTIMESTAMP" cannot be used with binary operator "-"
  the type of one or both of the operands is not supported for the
  operation. To perform this operation, one or both operands needs to be
  explicity cast with a cast operator.
Attempt to set the result type of binary operation "Getdate()-1" failed with error code 0xc0047081
  Evaluating function "DATEPART" failed with error code 0xc0047084

How can I solve it? Could you please give me another solution, maybe?
Thanks in advance!!

A:

The SSIS expression language does not support getdate()-1. You will have to use DATEADD(), i.e.
+ (DT_STR, 2 , 1252) DATEPART( "day" , Dateadd("day",-1,getdate())) 

Also, this should be done for each date part.  What happens when you get to the beginning of the year - 141231, would translate to 150131.
Lastly, doing this in an execute SQL task would be easier:
Select Right(Convert(char(8), getdate()-1,112),6)

