In this post, I am going to explain about renaming & moving processed files from active folder to archive folder using Foreach
Loop Container and File
System Task
Step 4:
Step 5:
Step 6:
Double-click File System Task, do the following changes as shown in below image
Step 7:
Step 8:
Step 9:
![](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg3rSkyuJd20BD0JaxmhWbtLa8JKaRn8-u-2Ns0Pz2vbvTgjPoeWaohYOMk89B2tX3yGK9GYfqn0DGOu-fYM027-P19kZO8D6aUFqqOGOA8xJ0MQPfYRC5uErULNCGsqVom7tL6h335uDqh/s640/r8.JPG)
![](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhl_j3UcCbMeZjztzDFl1Rm-BrmW6GaivZJdeDC4JY7QDYXXf-AqKJlz6y74oQ2c408ZOX_FUZI_BfmJD391qjryWppu-79r9Q1OKzzyJ1aw3JWgcT5_aqMA2S-KDsa7tKt7isW58kLuK4O/s640/r9.JPG)
Step 1:
Under Toolbox ->
Control Flow Items, drag&drop Foreach Loop Container into Control
Flow tab as shown in below image
Step 2:
Step 3:
Double-click Foreach Loop Container, under Variable Mappings tab, create an
variable as shown in below image for
holding filename
-> Retrieve file name A.txt if you have Name
and extension under Collection
tab
- > Retrieve file name A if you have Name only under Collection tab
- > Retrieve file name C:\Users\sathya\Desktop\Source_Folder\A.txt if you have Fully qualified under Collection tab
- > Retrieve file name A if you have Name only under Collection tab
- > Retrieve file name C:\Users\sathya\Desktop\Source_Folder\A.txt if you have Fully qualified under Collection tab
Step 4:
Under Toolbox ->
Control Flow Items, drag&drop File
System Task inside Foreach Loop
Container as shown in below image.
Step 5:
Under SSIS - > Variables
tab, create variables as shown in below image
Step 6:
Double-click File System Task, do the following changes as shown in below image
Step 7:
Click on FileTaskSourcePathVariable
and then goto Properties or press F4,
Set EvaluateAsExpression
= True and write the Expression and click Evaluate Expression as shown in below image
Step 8:
Click on FileTaskDestinationPathVariable
and then goto Properties or press F4,
Set EvaluateAsExpression
= True and write the Expression and click Evaluate Expression as shown in below image
Step 9:
Check the files in source folder, execute the package and
then check the files in destination folder.
4 comments:
Very Impressive, It worked perfectly
Thanks for sharing your knowledge
Hi Sathyanarrayanan,
Thanks a lot for your help. It made my day :)
Thank you for this fine article, it was really helpful!
Regards,
Artur
Good stuff, thanks for posting!
Post a Comment