Solution :
Step 2:
Bring For-each Loop container to Control Flow Pane and configure as shown below. I used the VarSourceFolder variable as Directory. If we need to change Source Folder Path,We do not have to open the package , Instead we can just change the value for this variable by using SSIS Configuration.
The Information we want to extract is File Name and extension , Choose that.
Create variable VarFileName to hold the FileName and extension
The For-each loop is loop through the folder files one by one and on each iteration file name and extension will be saved in VarFileName variable.
Step 3:
Create a new variable VarArchiveFullPath, Click on that and press F4, that will take you to properties. Go to expressions and paste below expression
@[User::VarArchiveFolder]+”\\”+ Replace(Replace(Replace(Replace( @[User::VarFileName],”.”,”_”+Substring((DT_WSTR,50) GETDATE(),1,19)+”.”),”-“,””),”:”,””),” “,”_”)
Set EvaluteAsExpression=True
Step 4:
Create a variable VarSourceFullPath, this will have Source Folder path and file name together. Write expressions on it as shown below
Step 5:
Bring File System task to Control Flow Pane and configure as shown below
Final Output:
Let’s run our SSIS Package and see if files are moved and renamed.
As we can see that all the files are moved from Source Folder to Archive Folder successfully and Time-Stamp is also added.