Answered by:
SSIS : Move file from one folder to other

Question
-
Hi Guys -
In a folder A i have 100's of pdf files. Below is the format:
CompanyName_CompanyID_CustomerID_Getdatetimestamp.
Sample file names : IronWorks_137_86678_20191008070511Firebrand_7_86678_20191008070511
Woodworks_150_86678_20191008070511
My question is, If the companyID in the file name has value of 1 or 7 or 141 or or 103 or 142, I need to move them to folder B.
How can i do this in SSIS ? Thanks
Answers
-
Hi kkran,
We could use Foreach Loop Container, Sequence Container(Null), Precedence Constraint,
File System Task to move specified files one folder A to folder B.
1.Extract all the filenames of the .pdf files in folder A.
2.Add expression in precedence constraint.
- Expression:
TOKEN( @[User::FileName] , "_",2 )=="1"||TOKEN( @[User::FileName] , "_",2 )=="7"||TOKEN( @[User::FileName] , "_",2 )=="141"||TOKEN( @[User::FileName] , "_",2 )=="142"
3.Move the specified files from folder A to folder B.
Best Regards,
Mona
MSDN Community Support
Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com- Edited by Mona LvMicrosoft contingent staff Wednesday, October 9, 2019 2:37 AM
- Proposed as answer by Mona LvMicrosoft contingent staff Wednesday, October 9, 2019 2:39 AM
- Marked as answer by kkran Wednesday, October 9, 2019 3:38 PM
All replies
-
-
Hi kkran,
I can find 10s of examples online you can use to do what you need.
-
Hi kkran,
We could use Foreach Loop Container, Sequence Container(Null), Precedence Constraint,
File System Task to move specified files one folder A to folder B.
1.Extract all the filenames of the .pdf files in folder A.
2.Add expression in precedence constraint.
- Expression:
TOKEN( @[User::FileName] , "_",2 )=="1"||TOKEN( @[User::FileName] , "_",2 )=="7"||TOKEN( @[User::FileName] , "_",2 )=="141"||TOKEN( @[User::FileName] , "_",2 )=="142"
3.Move the specified files from folder A to folder B.
Best Regards,
Mona
MSDN Community Support
Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com- Edited by Mona LvMicrosoft contingent staff Wednesday, October 9, 2019 2:37 AM
- Proposed as answer by Mona LvMicrosoft contingent staff Wednesday, October 9, 2019 2:39 AM
- Marked as answer by kkran Wednesday, October 9, 2019 3:38 PM