I have a file, test.txt that I want to copy/rename in a backup directory.
I have created the following User variables within my SSIS package:
Src_File = c:\test.txt
Dest_File = test
Dest_Dir = c:\backup
DelayValidation = True
I also created an Expression within the File System Task for the Destination:
@[Dest_Dir] + "\\" + @[Dest_File] + "_" + (DT_WSTR,4)DatePart("yyyy", GetDate()) + RIGHT("0" + (DT_WSTR,2)DatePart("mm", GetDate()), 2) + RIGHT("0" + (DT_WSTR,2)DatePart("dd", GetDate()), 2) + RIGHT("0" + (DT_WSTR,2)DatePart("hh", GetDate()), 2) + RIGHT("0" + (DT_WSTR,2)DatePart("mi", GetDate()), 2) + ".txt"
which gives me the following evaluation value: c:\test\test_200904202005.txt
When I go to debug, the package fails, and thows out the following error:
Error: Failed to lock variable "c:\test\test_200904202009.txt" for read access with error 0xC0010001 "The variable cannot be found. This occurs when an attempt is made to retrieve a variable from the Variables collection on a container during execution of the package, and the variable is not there. The variable name may have changed or the variable is not being created.".
I have been to a number of forums without any advice that has resolved this issue. Is there a bug within SSIS that won't allow you to concatenate a datetime stamp to a string variable? Or am I missing something very rudementary? This should not be this difficult. Any help would be highy appreciated.